JsPlumb and dynamically added containers

综合技术 2018-05-21 阅读原文

Since there's no jsPlumb forum anywhere I hope someone here can help me.

I want to generate this graph from some data I get from a JSON-API, what this API gives me are "devices" with a name and multiple sinks/sources, which I want to display as a list with the device-name in the first row.

So I thought I'd use some JQuery to generate these divs and add the jsPlumb-endpoints I need to the device. Unfortunately I can only get endpoints on existing divs to work but not on my dynamically generated ones. Firebug shows me the error "myOffset is null" in the addEndpoint function and I don't really see anything that's wrong.

I made a fiddle of it here: http://jsfiddle.net/2mcD2/4/

Id of an element is invalid, :
is not allowed in ids.

jQuery("#source:foo") // will not work
jQuery("*[id='source:foo']") // will work, but you'll need to modify `jsPlumb` code in order to make it work this way

Solution: do not use :
in ids. _
and -
are ok.

Hello, buddy!

责编内容by:Hello, buddy!阅读原文】。感谢您的支持!

您可能感兴趣的

Iterate returned the serial list c # &... I have a webmethod which will read the first line in a csv file to get the co...
Credit Card Validation using jQuery It always a good idea to validate credit card number on the client side before ...
Hover 1st DIV affects all other 1st DIVS I'm asking a basic question here, for some reason I can't get it to work. Any he...
JQuery:在项目中总结零散知识点(一)... 1. css()方法 (1) 返回 CSS 属性值 返回第一个匹配元素的 CSS 属性值。 ...
Shift offset of a fixed division from the top of t... So i have a long scrolling 1page website with a fixed navigation bar. With th...