How to get all links going out from a specific node

Hi
is there a function for getting all links going out from a specific node(the node the link goes to and the text written on the link)
thank you in advance

Yeah, Node.findLinksOutOf()

note also findLinksInto(), findLinksConnected()

thank you very much
if I convert a diagram to json then parse it to object can I use this function findLinksOutOf() on the object
I need for each node in my diagram a list containing links going out from it

var allNodesIt = myDiagram.nodes;
while(allNodesIt.next()){
nodeLinkStr+=allNodesIt.value.data.text;//node text
linkIt=allNodesIt.findLinksOutOf();//get all links out from it
while(linkIt.next()){//for each link get the link text and toNode text
nodeLinkStr+=linkIt.value.data.text;
nodeLinkStr+=linkIt.toNode().data.text;

	}
}

I tried this but it did not work

You have a few errors. You need to get the value of the iterator when calling findLinksOutOf. You also need the value of the link iterator. toNode is a property.

var allNodesIt = myDiagram.nodes;
while (allNodesIt.next()) {
  var node = allNodesIt.value; 
  nodeLinkStr += node.data.text; //node text
  var linkIt = node.findLinksOutOf(); // get all links out from it
  while (linkIt.next()) { // for each link get the link text and toNode text
    var link = linkIt.value;
    nodeLinkStr += link.data.text;
    nodeLinkStr += link.toNode.data.text;
  }
}
2 Likes

thaaaank you