Hareeshchandera / jsplumb

Automatically exported from code.google.com/p/jsplumb
0 stars 0 forks source link

add 'selectConnections' method #202

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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.

Original issue reported on code.google.com by simon.po...@gmail.com on 17 Feb 2012 at 12:25

GoogleCodeExporter commented 8 years ago
this is in 1.3.7 dev now - a function called 'select'.  here's an example:

jsPlumb.select().removeAllOverlays().setParameter("foo", 
"bar").setHover(false).setLabel("baz");

this selects all connections. here's the same thing for all connections from 
"d1":

jsPlumb.select({source:"d1"}).removeAllOverlays().setParameter("foo", 
"bar").setHover(false).setLabel("baz");

Original comment by simon.po...@gmail.com on 3 Mar 2012 at 5:09