EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: forum6691 on September 21, 2014, 11:43:58 AM



Title: Enable or disable individual checkbox of a tree
Post by: forum6691 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 ?


Title: Re: Enable or disable individual checkbox of a tree
Post by: stworthy 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;
}
}
})


Title: Re: Enable or disable individual checkbox of a tree
Post by: forum6691 on September 23, 2014, 11:42:31 AM
Thanks very much