如何删除jsPlumb连接
I am playing with jsplumb, but I am not able to delete the connection between two divs having only the id of one div.
If you've multiple connections from or to elements, detaching all connections is maybe not the best solution to delete a connection. There is a (not well documented) function to detach exactly one connection:
jsPlumb.detach(connection, {
fireEvent: false, //fire a connection detached event?
forceDetach: false //override any beforeDetach listeners
})
In my example, I want to delete a connection when the connector is clicked:
jsPlumb.bind('click', function (connection, e) {
jsPlumb.detach(connection);
});
2017年10月01日57分04秒
I found the solution in the documentation (http://jsplumb.org/doc/usage.html)
jsPlumb.detachAllConnections("elementId");
2017年10月01日57分04秒
If source div or target div id is already known, then you can delete the connection like this:
var conn = jsPlumb.getConnections({
//only one of source and target is needed, better if both setted
source: sourceId,
target: targetId
});
if (conn[0]) {
jsPlumb.detach(conn[0]);
}
You can also use jsPlumb.getAllConnections() to get the array of all connections, and test every connection's sourceId or targetId to get exactly the connection you need;
2017年10月01日57分04秒
After all the endpoint connections, to and from the element are deleted, you need to detach it as shown in the 3rd line
jsPlumb.detachAllConnections(divID);
jsPlumb.removeAllEndpoints(divID);
jsPlumb.detach(divID);
divID.remove()
2017年10月01日57分04秒
Hi you can refer to this: Detach connection jsPlumb
This block of code allows to detach connection if a connection was clicked:
jsPlumb.bind("click", function(conn) {
jsPlumb.detach(conn);
});
2017年10月01日57分04秒
This code removes all "wrong" connections in a game I'm developing. I hope it helps
var wrong_connections = new Array(DB_ID, ANOTHER_DB_ID);
var connections = jsPlumb.getConnections();
$.each(connections, function(index, value) { // going through all connections
var source_id = value.source.attr('id').substring(28); // I need the ID from DB so I`m getting it from the source element
for (var a = 0; a < wrong_connections.length; a++) {
if (source_id == wrong_connections[a]) {
jsPlumb.detach(value);
}
}
});
2017年10月01日57分04秒
jsPlumb.deleteConnectionsForElement(elementId)
works. Though it's old I'd like to add that finding out what methods a library has, provided it's self descriptive enough is quite easy.
如何删除jsPlumb连接的更多相关文章
- Oracle ORA-01940: 无法删除当前连接的用户
当我们要删除一个oracle的用户时,如果有其他人连接到数据库则会报以下错误: ORA-01940: 无法删除当前连接的用户 处理办法就是:将连接到当前用户的session给kill掉. 处理步骤如下 ...
- ORA-01940: 无法删除当前连接的用户
删除用户报错 SQL> drop user ODI_SRC CASCADE; drop user ODI_SRC CASCADE * 第 1 行出现错误: ORA: 无法删除当前连接的用户 查看 ...
- 解决ORA-29857:表空间中存在域索引和/或次级对象 & ORA-01940:无法删除当前连接的用户问题 分类: oracle sde 2015-07-30 20:13 8人阅读 评论(0) 收藏
今天ArcGIS的SDE发生了一点小故障,导致系统表丢失,所以需要重建一下SDE数据库,在删除SDE用户和所在的表空间过程中遇到下面两个ORA错误,解决方法如下: 1)删除表空间时报错:ORA-298 ...
- ORACLE无法删除当前连接用户
今天在做Oracle数据库是遇到ORACLE无法删除当前连接用户 ,经查找可用如下方法解决 . 在Oracle中删除用户时提示:ORACLE无法删除当前连接用户 可以用以下语句 Sql代码 ...
- 强制删除正在连接的Oracle用户,以删除SDE用户为例
. 有时候想强制删除一个已经连接的Oracle用户,不能直接删除,可以用Kill会话信息. 比如今天想删除一个被连接的SDE用户,可以用以下方法删除一个“正在被连接”的用户. 1.查看所有用户的会话信 ...
- tfs团队项目删除原来连接的默认账户
1.在用visual studio 连接团队项目时,首次输入用户名和密码后,默认保存住凭据了,等以后连接会自动采用首次的凭证. 但是如何采用新的用户重新登录呢.如图所示,删除原有的凭证.删除后重启电脑 ...
- linux 链接的使用 创建和删除符号连接(软、硬链接)
1 . 使用方式 :ln [option] source_file dist_file (source_file是待建立链接文件的文件,dist_file是新创建的链接文件) ...
- ora01940 无法删除当前连接的用户
我用system这个用户登录oracle,想删除掉一个自己创建的用户user,在网上找到的方法都是说先查找到该用户连接的会话select username,sid,serial# from v$ses ...
- linux 链接的使用 创建和删除符号连接
1 . 使用方式 :ln [option] source_file dist_file -f 建立时,将同档案名删除. ...
随机推荐
- react框架实现点击事件计数小案例
下面将以一个小案例来讲解react的框架的一般应用,重点内容在代码段都有详细的解释,希望对大家有帮助 代码块: 代码块: import React from 'react'; import React ...
- java线程池如何合理的设置大小
线程池究竟设置多大要看你的线程池执行的什么任务了,CPU密集型.IO密集型.混合型,任务类型不同,设置的方式也不一样 任务一般分为:CPU密集型.IO密集型.混合型,对于不同类型的任务需要分配不同大小 ...
- 为小程序开发创建本地mock数据服务器
开发时使用easy-mock的服务,不是大厂就不是大厂,实在恶心,每天都会有卡的这么一段时间 于是,自己建个本地mock服务算了,想使用express 但是必须把json数据里面的不同对象,分配到不同 ...
- php 全局变量问题
当在函数里通过require_once包含另外php文件. 而另外php文件包含了另外php文件,而该php文件的函数需要另外的php文件. 例子: installment_maintenance_s ...
- tomcat server.xml
基于对server.xml的学习,结合源码,可以进一步理解tomcat的架构设计 1. 2. 3. 4 .valve链 参考: http://www.importnew.com/17124.html ...
- Java泛型方法与泛型类的使用------------(五)
泛型的本质就是将数据类型也参数化, 普通方法的输入参数的值是可以变的,但是类型(比如: String)是不能变的,它使得了在面对不同类型的输入参数的时候我们要重载方法才行. 泛型就是将这个数据类型也搞 ...
- 实现Servlet容器一
本文是阅读<深度解析Tomcat>的笔记. 源码:http://www.brainysoftware.com/source/9780975212806.zip├── src│ └── ...
- Java 集合系列0、概述
概述: Collection 框架中 从最上层的核心主干可以看到:Iterator.Collection.Map 三个接口(拓展思考1)1.Collection 接口:主要包括了集合中的一些常用操作, ...
- linux 下camera调试笔记【转】
转自:https://blog.csdn.net/kevinx_xu/article/details/8801931 linux camera调试 2011-10-23 10:43:37| 分类: ...
- c语言的重构、清理与代码分析图形化浏览工具: CScout
网址: https://www.spinellis.gr/cscout/ https://www2.dmst.aueb.gr/dds/cscout/index.html https://github. ...