问题
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!
回答1:
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.
来源:https://stackoverflow.com/questions/17786329/jsplumb-1-4-1-deleteendpoint-by-uuid-or-object-example