Using `jsPlumb.makeTarget` with nested divs

357 views
Skip to first unread message

Aras Balali Moghaddam

unread,
Nov 24, 2012, 6:44:18 PM11/24/12
to jsp...@googlegroups.com
Hello,
In my application I have widgets that have several child divs and the child divs may further have their own children. I like to be able to use the `jsPlumb.makeTaret` function which elegantly converts the whole div into a target, making it very easy for user to finish the connection. I am facing an issue because most child divs overlay on top of their parent. Please take a look at this jsFiddle: http://jsfiddle.net/arasbm/aqYvZ/6/

I want the user to be able to make a connection between the first element (w1) and either of the three targets (w2,w3,w4). However, it seems that somehow the connection propagates up to the parent and I always end up with a connection between w1 and w2 in this reduced case. In my own application, I end up with 3 connections in one drag -- interestingly enough, but I have not been able to reproduce that behaviour on jsFiddle. How can we make it possible for user to use have the three possible connections here?

Cheers,
Aras

Simon Porritt

unread,
Nov 30, 2012, 6:00:21 PM11/30/12
to jsp...@googlegroups.com
I just got around to looking at this - what seems to be happening is that the drop event is not being consumed, and so if you drop on w4 then that event also gets posted to the w2 listener, which recognizes that it should establish a connection. this is happening before the event gets to jsPlumb.

if you reverse the order in which you register the divs:


then it works.

btw jsPlumb 1.3.3 is really old now. i'd recommend you upgrade to 1.3.16. 

Aras Balali Moghaddam

unread,
Dec 1, 2012, 1:17:14 AM12/1/12
to jsp...@googlegroups.com
Thank you for your response Simon. I am using 1.3.16 in my
application, I just forgot to change the version after I forked the
jsFiddle. The fiddle you send works exactly as I wanted it to. So if I
understand correctly, we dont have explicit control over how events
propagate from one element to another. Instead we would use the order
in which we create the jsPlumb source or targets, as an implicit way
to define what elements will handle the events first. This seems like
a tricky concept, and perhaps having a little information about it in
documentation could be helpful.

Anyways, thank you very much for your help!

Cheers,
Aras

ayobami ephraim

unread,
Sep 11, 2018, 12:40:37 PM9/11/18
to jsPlumb
This might be old but you just saved my Day 
Reply all
Reply to author
Forward
0 new messages