EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: nyr_jack on October 12, 2012, 01:15:19 AM



Title: Why can't determine the specified node is leaf or not
Post by: nyr_jack on October 12, 2012, 01:15:19 AM
js code:
for(var i = 0; i < nodes.length; i++){
     alert($('#orgTree').tree('isLeaf',nodes));
//......
}
json code:
[{
   "id":1,
   "text":"root",
   "children":[{
      "id":2,
      "text":"node2",
      "checked":false
   },{
      "id":3,
      "text":"branch",
      "state":"open",
      "children":[{
         "id":4,
         "text":"branch1",
         "checked":false
      },
      {
         "id":5,
         "text":"branch2",
         "checked":false      
      },
      {
         "id":6,
         "text":"3",
         "checked":false      
      }]
   }]
}]

I want to judeg the node of tree is leaf or not, but the return values are all true,not false, I don't know why. please help!


Title: Re: Why can't determine the specified node is leaf or not
Post by: stworthy on October 12, 2012, 02:38:50 AM
There are some errors in your code. Try the following code.
Code:
for(var i = 0; i < nodes.length; i++){
     alert($('#orgTree').tree('isLeaf',nodes[i].target));
//......
}


Title: Re: Why can't determine the specified node is leaf or not
Post by: nyr_jack on October 15, 2012, 08:16:30 PM
it works, thank you!