Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jsplumb 1.4.1 deleteEndpoint by uuid or object example

I have some div elements with 2 endpoints for each element (one the left and one the right side). Now I want to delete every right sided endpoint. Everyone of this endpoints has its own unique uuid. I got an array of every uuid of the right sided endpoints -> iterate through them and delete every single one of them but this wont work

can anyone give me an working example of deleting an endpoint by uuid or object ? in my case it wont work with both. I got this errormessage every time:

TypeError: o is undefined jquery.jsPlumb-1.4.1-all.js Line 681

$(elementArray).each(function(){
    //the uuid
    var currentUuid = 'rightEndpoint_'+this;
    //the endpoint object -> that acutually works
    var getCurrentEndpoint = jsPlumb.getEndpoint(currentUuid);
    //delete the endpoint -> here I got the error message
    jsPlumb.deleteEndpoint(currentUuid);
}); 

thanks in advance!

like image 494
oneandonlycore Avatar asked Mar 14 '26 13:03

oneandonlycore


1 Answers

var that=$('div');      //get all of your DIV tags having endpoints
for (var i=0;i<that.length;i++) {
        var endpoints = jsPlumb.getEndpoints($(that[i])); //get all endpoints of that DIV
            for (var m=0;m<endpoints.length;m++) {
                if(endpoints[m].anchor.type=="Right") //Endpoint on right side
                      jsPlumb.deleteEndpoint(endpoints[m]);  //remove endpoint
            }
}

By using above code there will be no need to store the Endpoints uuid.

like image 58
MrNobody007 Avatar answered Mar 17 '26 04:03

MrNobody007



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!