Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Trupti on Aug 04, 2009 00:24
open dhtmlx forum
DhtmlxTreeGrid

Hi,

I am evaluating your dhtmlxtreegrid to see if it can be used in one of our product. I have a query regarding treegrid.

I would like to know if it is possible to have different icons for a open node and closed node in case of a treegrid? I have seen the XML file description of dhtmlxtreegrid but it talks of having a single image for a cell in the grid. How can i configure different images for a cell based on whether a node in the cell is opened or closed.

Thanks.
Trupti
Answer posted by dhxSupport on Aug 04, 2009 02:53
You can change image at the treeGrid node with Basically icon of item can be changed by 
  grid.cell(i,j).setImage(url);
To define if treeGrid node was opend or closed you can use "onOpenEnd" event. The event occurs when branch opened. Event handler passes following parameters:
id - id of the node that will be opened/closed;
state - current open state of tree item; -1 means that the item is closed, 1 - item is opened.
grid.attachEvent("onOpenEnd", function(id,state){
if (state==1) grid.cell(i,j).setImage(url_for_opend_item);
else grid.cell(i,j).setImage(url_for_closed_item);
return true;
});