Controlling checkbox selection

Hi,

Say I have this tree structure

  • Root
    [list]
    []Category
    [list]
    [
    ]Sub Category
    [/:m][/list:u][/:m][/list:u]

And check the checkbox on Root - currently it “eagerly” cascades my selction down the tree and selects Category and SubCategory too. What if I don’t want this - but only want it to select what I actually select myself? How can I do that?

Thanks very much

Paul

Hi,

And check the checkbox on Root - currently it “eagerly” cascades my selction down the tree and selects Category and SubCategory too.

It isn’t a default behavior. You use 3-state checkboxes. Make sure that enableThreeStateCheckboxes method are not used.

Thanks. No, I don’t use that option.
It’s not a three stage check issue though - the problem is that when I check a node, the descendants of that node get checked also - and I don’t want that to happen.

Here’s my config…

var dhxTree = new dhtmlXTreeObject("tree_area", "100%", "100%", 0);

dhxTree.setImagePath("/javascripts/dhtmlx/dhtmlxTree/codebase/imgs/csh_winstyle/");
dhxTree.setLockedIcons("lock.gif","lock.gif","lock.gif");
dhxTree.enableCheckBoxes(1);
if (this.canDragAndDrop){
          dhxTree.enableDragAndDrop( true );
          dhxTree.setDragHandler(this.dragHandler);
}
dhxTree.enableSmartXMLParsing(true);
dhxTree.enableKeyboardNavigation(true);
dhxTree.enableKeySearch(true); 
dhxTree.enableItemEditor(true);
dhxTree.enableMultiselection(true);
dhxTree.enableSmartRendering(true);
dhxTree.enableAutoTooltips(1);

dhxTree.setEditStartAction(false, true); // enter edit mode on a double-click
dhxTree.attachEvent( "onClick", this.onNodeClick )//set function object to call on node select
dhxTree.setOnCheckHandler(this.onNodeCheck);//set function to call on open/close node
dhxTree.setOnEditHandler(this.onEditHandler);
dhxTree.setOnLoadingEnd(function(){$('tree_loading').hide();});

if (this.expandToTreeNodeId != -1){
        dhxTree.attachEvent("onXLE", function(){
          this.openItem(this.expandToTreeNodeId);
          this.focusItem(this.expandToTreeNodeId);
          this.selectItem(this.expandToTreeNodeId, false, false);
});
}

dhxTree.loadXML(this.dataUrl);

You may check standard tree samples:

dhtmlx.com/docs/products/dht … boxes.html

The issue doesn’t occur there.

Check the onNodeCheck method called when nodes are checked.

Thank you! Indeed, our implementation of the setOnCheckHandler was the problem.