EasyUI Forum
May 07, 2024, 11:46:49 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: getNode on tree node does not return correct object  (Read 8909 times)
jherrera
Newbie
*
Posts: 7


View Profile
« on: November 21, 2013, 06:42:49 AM »

Hi there,
I'm having some troubles with object returning from getNode method on tree widget:

This is not working:
Code:
var nodeid = 23; // This node exists, of course
var node = $('#SomeTree').tree('getNode', nodeid);
$('#SomeTree').tree('uncheck', node.target); // This trows an error "Uncaught TypeError: Cannot call method 'replace' of undefined "

And this works:
Code:
var checked = $('#SomeTree').tree('getChecked');
$('#SomeTree').tree('uncheck', checked[0].target); // This unchecks that node of checked[0]

What am I doing wrong?

Thanks in advance,
Juan
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 22, 2013, 12:21:08 AM »

To find a node with id value, please use 'find' method instead.
Code:
var nodeid = 23; // This node exists, of course
var node = $('#SomeTree').tree('find', nodeid);
Logged
jherrera
Newbie
*
Posts: 7


View Profile
« Reply #2 on: November 22, 2013, 04:45:55 AM »

Great! It works as expected, 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!