Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Alok on Jul 24, 2008 06:32
open dhtmlx forum
dhtmlxTree- Three state checkboxes

dhtmlxTree- Three state checkboxes

When you select the parent node all the child nodes of it will get selected and when you deselect all the child nodes then the parent will get deselected, but my requirement is that the parent still need to be in selected state.

If we save the tree by getting the xml and try to load the tree with the same saved xml the Parent node still need to be in selected state though the child nodes are unselected (since it is saved like that).

Help me in this.
Answer posted by Support on Jul 24, 2008 08:52
>>the Parent node still need to be in selected state though the child nodes are unselected
While loading tree doesn't use any rules, it just load XML as is, so it possible to load data with any checkbox state

>>but my requirement is that the parent still need to be in selected state.
While it possible to achieve such effect by code modification, I'm not sure that such logic will work stable enough.

dhtmlxtree.js, line 3353
   dhtmlXTreeObject.prototype._setSubChecked=function(state,sNode){
...
    var z=sNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];

can be changed as

    var z=sNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];
    if (sNode.childsCount && !state)  return; //block unchecking of parent item