最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jsPlumb and dynamically added containers - Stack Overflow

programmeradmin1浏览0评论

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: /

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/2mcD2/4/

Share Improve this question asked Mar 12, 2012 at 21:00 ChrisChris 2172 silver badges9 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

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.

there's a jsPlumb group here:

https://groups.google./forum/?fromgroups#!forum/jsplumb

发布评论

评论列表(0)

  1. 暂无评论