In jointJS I want for every element to check the number of incoming connected links.So this is the code I made according to documentation but it doesn't work:
_.each(this.graph.getElements(), function(element) {
var inboundLinksCount = this.graph.getConnectedLinks(element, {inbound: true}).length;
alert(inboundLinksCount);
}
This is the documentation of getConnectedLinks
in jointJS:
http://resources.jointjs.com/docs/jointjs/v1.0/joint.html#dia.Graph.prototype.getConnectedLinks
Any ideas please?
please try the below instead of this.graph you could use your graph variable name at both places where 'this.graph' is. for debugging try console.log(graph.getElements) and graphe.getConnectedLinks(element)) if it writes any output on the console.
_.each(this.graph.getElements(), function(element) {
var inboundLinksCount = this.graph.getConnectedLinks(element, {inbound: true});
alert(inboundLinksCount);
}