问题描述
我有一些div元素,每个元素有2个端点(一个在左边,一个在右边).现在,我要删除每个右侧端点.这个端点的每个人都有自己独特的uuid.我得到了右侧端点的每个uuid的数组->遍历它们,并删除其中的每一个,但这行不通
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
有人可以给我一个通过uuid或object删除端点的工作示例吗?在我的情况下,这两者都不起作用.我每次都会收到此错误消息:
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未定义jquery.jsPlumb-1.4.1-all.js681行
TypeError: o is undefinedjquery.jsPlumb-1.4.1-all.jsLine 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);
});
提前谢谢!
推荐答案
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
}
}
通过使用以上代码,无需存储端点uuid.
By using above code there will be no need to store the Endpoints uuid.
这篇关于jsplumb 1.4.1 deleteEndpoint通过uuid或对象示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!