How to Count Children Nodes on Javascript Fancytree? -


i created category tree using fancytree drag & drop functionality like

enter image description here

now, want set limit child node. if parent node have 3 child node not able create new child not example

category

parent category

  • child category allowed

    • child category allowed

      • child category not allowed move

like create javascript this.

dragdrop: function(node, data) { if( node.getlevel() >= 3 ){     return false; } console.log( node ); console.log( data ); var parentnodekey = node.key; var sourcenode = $(data.helper).data("ftsourcenode"); if( !data.othernode ){     var title = $(data.draggable.element).text() + " (" + (count)++ + ")";     node.addnode({title: title}, data.hitmode);     return; } data.othernode.moveto(node, data.hitmode); 

}

this working fine when move single category. not working when move "moved node" category because category have 2 child node , child node have 2 child nodes like

enter image description here

i move "moved node" , working how can count child nodes or stop moved nodes. want set limit creating 3 child nodes. how can this. , how can count child nodes of moveing category.

thanks

child nodes can counted using node.countchildren, description guess want count maximum level of child nodes?

there no builtin method that, can implement using node.visit().


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -