Search code examples
jqueryjquery-uieventsevent-handlingjsplumb

How to catch jsPlumb-Draggable event?


I want to save positions of the nodes after dragging. I am currently using jquery-ui draggale event to catch events. It's working alright BUT it has affected the capability to make connections. When you want to make connection it starts dragging the whole element and it's a mess to make a new connection.

My Code to catch event is as follow:

$(".window").draggable({
 drag:function(e){
    jsPlumb.repaint($(this));
        var position = $(this).position();
        var id = this.id;
        $.post( "/route_here", {position_top: position.top, position_left: position.left, activity_id: id} ,function( data ) {
            console.log(data);
        });
    },
})

Solution

  • I did a work around. I wrote a similar drag function for the connection maker and in that used the event.stopPropagation() and event.preventDefault() and the issue is resolved.Now we can make connections smoothly.