EasyUI Forum
September 14, 2025, 06:24:47 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: UI Tree change behavior  (Read 7081 times)
jlivio
Newbie
*
Posts: 11



View Profile Email
« on: June 26, 2015, 02:33:45 AM »

Hi!

In a structure like this

1
--- 1.1
--- 1.2

When I click (1) is it possible to reverse the process? instead of check 1.1 and 1.2 automatically, I want to unchecked, but when I check (1.1, 1.2) the behavior is the same (1) become indeterminate.

Thanks
Joao 
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: June 26, 2015, 06:19:16 AM »

When check a node, the 'onCheck' event fires. You can call 'uncheck' method to un-check all the child nodes when a parent node is checked.
Code:
$('#tt').tree({
cascadeCheck: true,
onCheck: function(node, checked){
var opts = $(this).tree('options');
var onCheck = opts.onCheck;
opts.onCheck = function(){};
var data = $(this).tree('getData',node.target);
if (data.children){
for(var i=0; i<data.children.length; i++){
$(this).tree('uncheck', data.children[i].target);
}
}
opts.onCheck = onCheck;
}
})
Logged
jlivio
Newbie
*
Posts: 11



View Profile Email
« Reply #2 on: July 03, 2015, 04:10:11 AM »

Hi!

I explained badly on this

behavior is the same (1) become indeterminate.

Ment to say

behavior is the same (1) become checked.

Thanks for helping. When include your code, I'm not able to check (1), only (1.1) and (1.2).

Can you give me a clue?

Thanks
Joao
« Last Edit: July 03, 2015, 04:32:02 AM by jlivio » 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!