add 'selectConnections' method?

35 views
Skip to first unread message

simon....@gmail.com

unread,
Feb 16, 2012, 7:27:17 PM2/16/12
to jsPlumb
one thing that i've found to be quite painful in the jsPlumb API is
dealing with more than one connection at a time. there is a
getConnections method but it requires that you loop through its
results one by one; plenty of times i've wanted to select a list of
connections and operate on them en masse, like

jsPlumb.getConnections({source:"some element"}).setHover(true);


so i'm proposing to add a 'selectConnections' method to jsPlumb, which
wraps getConnections and executes some operation on all of them.
ideally the list of operations supported would be everything that a
single connections supports, plus a couple of the methods in jsPlumb
like "detach" (actually i can't think of another one off the top of my
head).

this would also be chainable - each operation would return the full
list.


i'm interested in what people think of this idea.


here's the issue on google code:

http://code.google.com/p/jsplumb/issues/detail?id=202

Davis Ford

unread,
Feb 16, 2012, 8:22:35 PM2/16/12
to jsp...@googlegroups.com
Sounds useful to me.  I haven't had a need for this directly, but I could see it coming as I evolve my app.

Honestly, the most painful thing for me was wrapping my head around the huge number of configuration options -- I don't think this is really a bad thing..as it is indicative of how versatile it is.  I just had to sit down for a full day and hammer away at it until I understood what they all do and got the terminology straight -- the demo apps are very useful for this purpose.  It's a great library.  I originally started with WireIt, and abandoned it once I discovered jsPlumb.

cedric roussel

unread,
Mar 2, 2012, 2:53:00 AM3/2/12
to jsp...@googlegroups.com
jsPlumb.getConnections({source:"some element"}).setHover(true);
Makes chart a lot cleaner when multiple connections are bound to the same connector.

Even in this demo: http://jsplumb.org/jquery/chartDemo.html
When hovering a connector, I think most user expect both connections to get hover state.
Only the first created connection get highlighted and that doesn't really make sense to me.

This is definitly something I would use if it can be that easy :)

Simon Porritt

unread,
Mar 2, 2012, 3:52:04 AM3/2/12
to jsp...@googlegroups.com
yeah i think i will do this.

but for backwards compatibility i will probably not overload
'getConnections'. i think i'll add a new 'select' method, so we can
have stuff like:

jsPlumb.select({source:"some
element"}).setHover(true).showOverlay("anOverlayId");

--
Simon Porritt

+61 (0) 459 762 779

Reply all
Reply to author
Forward
0 new messages