EasyUI Forum
May 04, 2024, 12:26:59 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / EasyUI for jQuery / Re: How to get child nodes (only folders and not leaf nodes) from easy ui tree on: August 06, 2013, 02:50:38 AM
Hi stworthy,

Thank you so much for your solution..  Smiley
It works great.

Regards,
Shalini S.
2  General Category / EasyUI for jQuery / How to get child nodes (only folders and not leaf nodes) from easy ui tree on: July 18, 2013, 09:09:18 PM
Hi,
I need to get the child nodes from easy ui tree. And that child nodes should only include the sub  folders and not the leaf nodes. I had achieved this with the below code. But this might have performance issue due to the for loop if i have a huge tree. Hence i would like to know if there is any other way where we can get only the sub folders. Please help me resolve this.
Code:
var node = $('#tt').tree('getSelected');
var child_node = $('#tt').tree('getChildren', node.target); // This gives all the childs i.e folders and leaf nodes.
var count = 0;
for(var i=0; i< child_node.length; i++)
{
   var child = $('#tt').tree('isLeaf', child_node.target); //Boolean - true if the child_node is leaf, else false
   if(!child)
      count = count + 1; // Increment count and get the count of Folders when leaf is false
}
alert('count' + count);

Regards,
Shalini S.
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!