EasyUI Forum
April 29, 2024, 02:15:04 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Why can't determine the specified node is leaf or not  (Read 11446 times)
nyr_jack
Newbie
*
Posts: 31


View Profile
« 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!
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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));
//......
}
Logged
nyr_jack
Newbie
*
Posts: 31


View Profile
« Reply #2 on: October 15, 2012, 08:16:30 PM »

it works, thank you!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!