Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Feb 13, 2007 14:21
open dhtmlx forum
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.

Answer posted on Feb 13, 2007 14:27


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/unchecked
  • Current checkbox state. 1 - item checked, 0 - item unchecked.

Example:
            yourTree.setOnCheckHandler(
            function(id,state){
                        alert(“Item ID: ”+id)
                        alert(“Item checked: ”+state)

})

Answer posted by Nadine (Support) on Dec 03, 2014 03:02

Having solved the problem mentioned above, you may also look through the possible related problems with javascript table filter and google event calendar.