Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic limit number of children (Read 1802 times)
Bill
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Mar 31st, 2016
limit number of children
Apr 3rd, 2016 at 7:06pm
Print Post  
I need to programmatically limit the number of children that a node can have. Some will be allowed 2 or more, some will be allowed only 1. How can I determine the number of children a node currently has, so I can decide whether to allow another.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3378
Joined: Oct 19th, 2005
Re: limit number of children
Reply #1 - Apr 4th, 2016 at 8:13am
Print Post  
You could check the size of OutgoingLinks array -

Code
Select All
function onLinkCreating(sender, args)
{
	var link = args.getLink();
	var origin = link.getOrigin();
	args.setCancel(
		origin.getOutgoingLinks().length > 2);
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint