How to find out which UUID was used in a connection ?

526 views
Skip to first unread message

Tim Melis

unread,
Mar 4, 2015, 10:31:37 AM3/4/15
to jsp...@googlegroups.com

Hi,

I've create a small demo project, in which all objects have only 1 start endpoint, and 1 receicing endpoint.

When checking the data in jsPlumb.getConnections(), I notice that the "source" and "target" properties of a connection, contain only the ID of the object and not the UUID of the endpoint.

Now, I would to expand my example by using multiple starting and receiving endpoints. The goal is to make the application persistent and be able to save and reload the connection data.

My question is now: How can I rebuild the connections, based on the jsPlumb.getConnections() data, if there is no reference to a specific endpoint/UUID. How do I find out, based on the current information, which connection uses which endpoints ?

Any feedback would be helpful ....


Simon Porritt

unread,
Mar 10, 2015, 6:45:14 PM3/10/15
to jsp...@googlegroups.com
I think the answer is probably that you need the getConnections method to report the uuid of the endpoints...which it doesnt do at the moment. Feel free to open an enhancement request if you would like to.

Peter Hodges

unread,
Mar 12, 2015, 5:54:25 AM3/12/15
to jsp...@googlegroups.com
You have the connection object so you can do connection.getEndpoints()[index].getUuid() I believe.

Tim Melis

unread,
Mar 20, 2015, 8:16:58 PM3/20/15
to jsp...@googlegroups.com

Hi Peter,

I checked and checked again. Every endpoint of the endpoints collection, part of the connection object, does NOT contain any property containing a reference to the UUID.
A connection has 2 ID properties, "sourceId" and "targetId", containing a reference to some sort of internal ID of the endpoint, but doesn't contain any UUID information.

After some struggle, I was able to solve this issue by creating an array of custom connection objects. When a new connection is created, based on the X and Y location of the endpoint, as well as the use of logical endpoint names, I was able to get the UUID and store it in my custom collection. Based on the UUID, I then was able to rebuild the connections, based on the UUIDs.

I hope a next version of jsPlumb will include some sort of UUID references in the connection object.

Simon Porritt

unread,
Mar 20, 2015, 8:31:17 PM3/20/15
to jsp...@googlegroups.com

Did you not see my reply about the getConnections method? You need it to be updated to include uuids if they are present, yes. You could create an enhancement request if you wanted to. It would be easy to get into the next release, 1.7.5.

Reply all
Reply to author
Forward
0 new messages