In my project, I want a product belong multiple

In my project, I want a product belong multiple
categories, so I use the checkbox function of dhtmlxtree.

My questions are:

1.   How can I set the checkbox be checked when the tree be initialed?

Because my product categories data is come from mysql.  I want it when I
modify a product, it can remember what categories are belonging. And next time
when I modify the product, it can show the last time what categories I checked.

2.   How can I get �an� item ID when I check it?  (Not All Item ID, such
like getSelectedItemId() function)

Because I want when the item is checked, it will update the status in mysql by
each time. So, I need a item ID, not get all item ID.


1. use �checked� attribute in item tag to set item checked � checked=�any value�

2. use onCheck event handler. To set it use the following method:
setOnCheckHandler(func)
sets function called before checkbox checked/unchecked
EventName:onCheck
Even handler gets following values:
ID of item which will be checked/uncheckedCurrent checkbox state. 1 - item checked, 0 - item unchecked.Example:
            yourTree.setOnCheckHandler(
            function(id,state){
                        alert(�Item ID: �+id)
                        alert(�Item checked: �+state)

})