EasyUI Forum
September 14, 2025, 02:10:29 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Question - tree cascadeCheck/onCheck event  (Read 9081 times)
davistom
Newbie
*
Posts: 10


View Profile Email
« on: May 13, 2015, 05:49:57 AM »

I am trying to use the tree component to control a non easyui object (a google map) and have a question about interaction of the cascadeCheck property and the onCheck event. Specifically, I would like to have the following behavior: check of a parent node causes check of its descendants (cascadeCheck) and triggers the onCheck event for parent and descendants. What I observe is that cascadeCheck works as expected (i.e. descendants get checked recursively) but the onCheck event gets triggered only for the parent node, i.e. the node which I check manually. Am I correctly interpreting the intended and actual behavior?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 13, 2015, 08:24:11 AM »

The 'onCheck' event only be triggered on the parent node. If you really want to make all children nodes to be triggered, please set the 'cascadeCheck' property to false and then call 'check' method on all children nodes.
Code:
$('#tt').tree({
cascadeCheck: false,
onCheck: function(node){
console.log(node.text)
var data = $(this).tree('getData',node.target);
if (data.children){
for(var i=0; i<data.children.length; i++){
$(this).tree(node.checked?'check':'uncheck', data.children[i].target);
}
}
}
})
Logged
davistom
Newbie
*
Posts: 10


View Profile Email
« Reply #2 on: May 13, 2015, 09:19:39 AM »

Thanks.
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!