【问题标题】:jsplumb 1.4.1 deleteEndpoint by uuid or object examplejsplumb 1.4.1 deleteEndpoint by uuid 或对象示例
【发布时间】:2013-07-22 11:23:49
【问题描述】:

我有一些 div 元素,每个元素有 2 个端点(一个在左侧,一个在右侧)。 现在我想删除每个右侧端点。 每个端点都有自己独特的 uuid。 我得到了右侧端点的每个 uuid 的数组 -> 遍历它们并删除它们中的每一个,但这不起作用

谁能给我一个通过 uuid 或 object 删除端点的工作示例? 就我而言,两者都不起作用。我每次都收到此错误消息:

TypeError: o 未定义 jquery.jsPlumb-1.4.1-all.js 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);
}); 

提前致谢!

【问题讨论】:

    标签: javascript jquery jsplumb


    【解决方案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
                }
    }
    

    通过使用上述代码,将无需存储 Endpoints uuid。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-04
      • 2014-06-01
      • 2010-11-18
      相关资源
      最近更新 更多