Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to get the nodes using getLink() (Read 2065 times)
JaymeW
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
How to get the nodes using getLink()
Oct 14th, 2021 at 8:20pm
Print Post  
Hi, I am new and trying understand how getLink() works. I have a diagram and i want show a simple message saying which nodes are connected to whom.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: How to get the nodes using getLink()
Reply #1 - Oct 15th, 2021 at 6:19am
Print Post  
Hi,

You can find which nodes are connected by a link via its origin and destination properties. E.g. with version 4 properties API -

Code
Select All
for (let link of diagram.links)
{
	var src = link.origin;
	var dst = link.destination;
	console.log(`${src.text} -> ${dst.text}`);
} 



or using V3 get/set functions:
Code
Select All
for (let link of diagram.getLinks())
{
	var src = link.getOrigin();
	var dst = link.getDestination();
	console.log(`${src.text} -> ${dst.text}`);
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
JaymeW
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 24
Joined: Oct 14th, 2021
Re: How to get the nodes using getLink()
Reply #2 - Oct 15th, 2021 at 11:28am
Print Post  
Thanks Cheesy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint