EasyUI Forum
June 16, 2024, 03:56:03 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: Enable or disable individual checkbox of a tree  (Read 8153 times)
forum6691
Newbie
*
Posts: 39


View Profile
« on: September 21, 2014, 11:43:58 AM »

Hello

I have a tree with many nodes with checkbox.
When I select a checkbox, I call an asynchrone task which puts data in a array and when I deselect the same checkbox, I execute synchrone task which modify (delete) data from the same array.

I have a problem when I check/uncheck quickly the checkbox. The sync task is executed before the end of the async task and the behaviour is inccorect.

I can prevent this problem if I disable temporarily the checkbox (it becomes Grey tint as on microsoft Windows) and I enable the checkbox when the assync task is finished to prevent the user to modify the checkbox.

Unfortunately, I haven't seen in the documentation a means to achieve this.

Could you help me ?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: September 21, 2014, 04:56:36 PM »

You can use the 'onBeforeCheck' event to define how a node can be checked. When returning false in this event, the checking action will be aborted.
Code:
$('#tt').tree({
onBeforeCheck:function(node,checked){
if (somecondition){
return false;
}
}
})
Logged
forum6691
Newbie
*
Posts: 39


View Profile
« Reply #2 on: September 23, 2014, 11:42:31 AM »

Thanks very much
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!