Disable checkbox issue

Hi

I am trying to disable a check box during tree initialisation but it is never disabled.

realWorldTree = groupLayout.cells("a").attachTree();
realWorldTree.setImagePath("js/tree/imgs/csh_dhx_skyblue/");
realWorldTree.loadXML("real-world-tree.xml");
realWorldTree.enableCheckBoxes(1);
realWorldTree.enableSmartXMLParsing(true);
realWorldTree.disableCheckbox("root", true); (also tried 1 instead of true)
realWorldTree.setOnCheckHandler(realWorldCheck);

Is my code incorrect?

Thanks
Wimac

Also, is it possible to hide a checkbox? I don’t want the user to be able to check the root node.

I am trying to disable a check box during tree initialisation but it is never disabled.

To disable checkbox you need to call disableCheckbox () after all the items of a tree are loaded.

Also, is it possible to hide a checkbox? I don’t want the user to be able to check the root node.

you can only hide all checkboxes in a tree with help of enableCheckBoxes() method: http://docs.dhtmlx.com/doku.php?id=dhtmlxtree:api_method_dhtmlxtreeobject_enablecheckboxes

Also you may try to “hide” a checkbox by setting “nocheckbox” attribute to true in a needed item in xml:

<item nocheckbox="1" text="Mystery Thrillers" id="mystery">