In my app, I am using jsPlumb lib in one module, Is there any way to find out unconnected endpoints?
Asked
Active
Viewed 344 times
1 Answers
1
Since there is no function in API Document to get all endpoints, hence you need to get all the elements having endpoints and check whether its endpoints have connections:
var elem = $('.havingEndpoint'); // get elements having endpoint based on its class
var emptypoints=[],k=0; //consists of all empty endpoint objects which can be used to manipulate them
for(var i=0;i<elem.length;i++) // for all elements having endpoints iterate
{
var eps=jsPlumb.getEndpoints($(elem[i])); //get all endpoints of element
for(var j=0;j<eps.length;j++)
{
if(eps[j].connections.length==0) // check no. of connections
emptypoints[k++]=eps[j]; //if true add to emptypoints array
}
}
console.log("no. of empty points: "+ k);

MrNobody007
- 1,827
- 11
- 32