Get node id when checkbox is selected

Hi,

I am using the tree with the checkboxes.



tree=new dhtmlXTreeObject(“treeboxbox_tree”,“100%”,“100%”,0);

tree.setImagePath("./imgs/");

tree.enableCheckBoxes(1);

tree.enableSmartXMLParsing(true);

tree.setOnCheckHandler(click);

tree.loadXML(’<%=distXml%>’, doAfterLoading);



function click() {

// get the id of the node that was clicked, and then figure out if it was selected or de-selected

var id = tree.getSelectedItemId();

}



When I select the text of a node and then select its checkbox, tree.getSelectedItemId() returns the correct id. But if I select a checkbox without selecting the node, tree.getSelectedItemId() always returns the id of the last selected text item/node. If there is no selected text node, it returns the id of the first node in the tree.



I would like to get the id of a node when I select its checkbox, without selecting its text item.



Please help if you know how I can do this. Your help is very much appreciated.



Thanks,

Sushil

I would like to get the id of a node when I select its checkbox
tree.attachEvent(“onCheck”,click);
function click(id) {
alert(id);
}

dhtmlx.com/docs/products/dhtmlxT … tml#api_ev