Search code examples
jsplumb

Can't get source and target uuid's of a connection's endpoints


I want to reach source and target uuid's of a connection's endpoints in "beforeDrop" event.

I tried;

instance.bind("beforeDrop", function (info) {
                alert(info.connection.source.getUuid())
            });

But it does not work. How can I reach them?


Solution

  • getUuid() is the Endpoint Class method, so:

    instance.bind("beforeDrop", function (info) {
        alert(info.connection.endpoints[0].getUuid());
        return true; /* if you need to establish connection */
    });
    

    But if you need to get endpoints uuids of already established connection the best way will be to use "connectionDragStop" event:

    instance.bind("connectionDragStop", function(conn, ev) {
        var uuids = conn.getUuids();
    });