Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by jrw on Sep 10, 2009 15:12
open dhtmlx forum
dhtmlXTree setSubChecked does not call attached onCheck event handling function

The tree's behavior is as expected if a checkbox is directly clicked with a mouse: the "onCheck" attached function is called.
If I click a button which makes a call to setSubChecked(0,true) then the checkboxes themselves do all become checked, but the attached "onCheck" function is not called, while I expected it to be called once for each of the descendant nodes.
If that is the expected behavior, what is the recommended way of calling the attached function once for each of the nodes in the entire tree?

Thanks for your help.
Answer posted by Support on Sep 11, 2009 01:58
This is expected behavior. Event occurs only for actions which directly triggered by a user. If change of state was triggered by API call - the events will not be triggered. 

>>what is the recommended way of calling the attached function once for each of the nodes in the entire tree
var ids = tree.getAllSubItems(0).split(","); //get all IDs
for (var i=0; i<ids; i++) //for each node in tree
       tree.callEvent("onCheck",[ids[i],true]); //trigger onCheck event 


It possible to modify source code of tree , so it will call onCheck event for API triggered cases. Please inform if you need details about such modification.