I am using TreeGrid with dynamic loading of subnodes. Is it possible to enforce reloading of a specific node’s children when the node has already been opened by the user?
Can one maybe achieve this by programmatically close/collapse the node and then somehow reset it such that when it is programmatically reopened it reloads its subnodes?
My specific problem is that I have treegrid with a column of checkboxes and that I want to check/uncheck all subnode’s checkboxes when the parent’s checkbox has been checked/unchecked. Maybe there is even some built-in functionality of TreeGrid for this purpose, like in dhtmlxTree?
Thanks a lot for any hints.
Is it possible to enforce reloading of a specific node’s children when the node has already been opened by the user?
There is no single method for such case, but can be done by
treegrid.deleteChildItems(ID)
treegrid.loadXML(“some.php?id=”+ID);
first part of command will delete all existing child nodes, the second one reload XML for the same branch
Also, you can try to use
treegrid.updateFromXML(“some.php?id=”+ID)
this command may updated, delete, add rows based on configuration.
>>Can one maybe achieve this by programmatically close/collapse the node
and then somehow reset it such that when it is programmatically
reopened it reloads its subnodes?
Not tested, but must work in most situations
treegrid.deleteChildItems(ID)
treegrid._h2.change(ID,“state”,“plus”); //set correct branch state
treegrid._h2.get[ID]._xml_await=true; //set xml loading flag
>>that I want to check/uncheck all subnode’s checkboxes when the parent’s checkbox has been checked/unchecked
There is no native support for 3-state checkboxes in treegrid
You can implement something similar with
treegrid.attachEvent(“onCheckbox”,function(id,ind,state){
treegrid._h2.forEachChild(function(el){
treegrid.cells(el.id,ind).setValue(state?1:0);
});
});