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.

您可能感兴趣的

JQUERY adding and removing class individually I have created a form click here to view . The form consists of a basic validation functionality, one character checks and the validates number fi...
Best way to do Flip animation What is the best way to show an animation using images as frames? I am planning to play a short animation by quic...
JQuery: for the change of attr of the el... I'm having a bit of trouble with my for loop. I think this should be relatively easy but for some reason I just can't figure it out! I have a for l...
I need an easy way to detect CSS3 media query supp... I need a quick and dirty way to detect media query support using jquery. I defined a function as follows: function mediaQueriesEnabled () ...
Is it good to use the amd version of the backbone&... I am starting my project structure from scratch. I am using require.js, backbone, underscore, bootstrap, etc. I was thinking to use shim config to loa...