Posts

Showing posts from June, 2016

Deleting Connections when elements are deleted in jsPlumb

Image
Removing the connections along with the parent element can be  little tricky if not correctly handled. This requires the maintenance of information regarding a connections source and target. 
In order to do so, we'll be using an array called 'list'. The list array is a two- dimensional array instantiated with the number of connections at the time of deletion of a parent element. 
An event listener will be called when the user clicks on the cancel icon of an element, as shown below. (I've tried as far as possible to simplify each and every code line via comments)


































The reason to declare the list array within the call to delete listener is the fact that there is no viable place other than this that could assure that the user has fully completed connecting as desired, plus there is little to no concern regarding this details up till an element needs to be deleted( up till what we've covered in this context, but the connection details are crucial when it comes to processing…