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!阅读原文】。感谢您的支持!

您可能感兴趣的

Onload does not charge iframe jquery On my page i have 2 iframes. I have a function to reload the iframe on click. Now I would like to load the main page...
CORS PUT: Not found with jQuery.ajax I want to send some raw data to a subdomain of mine: $.ajax({ url: "http://accounts.example.com:3000/me", ty...
JQuery Syntax for conditional logic with radio but... My form is supposed to show an image based on the radio buttons selected in two different fields (form & color). I...
码云推荐 | Beanbun 的数据抽取插件 Beanbun-parser... beanbun-parser 简介 beanbun-parser 是 Beanbun 的数据抽取插件。通过设置抽取规则,在每次爬取页面之后,可以自动提取页面数据到数组中以供使用。抽取规则的选择器语法类似于 jQue...
Uncaught TypeError: $ &lp... PHP socket chat * { margin: 0; padding: 0; box-sizing: border-box; } body { font: ...