onClick event when expanding a node in the tree grid

Is there an onClick event when clicking a plus sign to expand a node in the tree grid (using dynamic loading)? On a similar note, where can I find documentation on all of the onClick events for the grid/tree grid?



Thanks.

You can use “onOpenStart” and “onOpenEnd” events. Please find more information about availible events here dhtmlx.com/docs/products/dhtmlxG … rid_api_ev

I am using the onOpenStart() event but it is not giving me what I need.  I am trying to retrieve the number of rows in the grid after the node has been expanded.  When I print out the number of rows in the grid (gird.onRowsNum()) in the event, it’s the number of rows before the node got expanded.  Also, once I attached the event the node does not expand anymore?

it’s the number of rows before the node got expanded
Yes, onOpenStart event occurs when opening initiated, but not started yet. You should use “onOpenEnd” event instead
>>Also, once I attached the event the node does not expand anymore
This event is blockable. If event returns: true - confirms opening/closing; false - denies opening/closing. So your code should looks like that:
grid.attachEvent(“onOpenStart”, function(id,state){
//your code here
return true;
});


Using the onOpenEnd event doesn’t work for me because that only gets fired when the node is being closed.  I need an event that fires after the node has been expanded but before it is closed.  How can I do this?



Thank you.

onOpenEnd event occurs when branch opened (in case of dyn. loading - after xml loading). This event passes the 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.

So to detect if branch was opend and all row was loaded you should use:
grid.attachEvent(“onOpenEnd”, function(id,state){
if (state) {
//items is opend
}
if (!state) {
//items is closed
}
});

When I attach the onOpenEnd event, it fires only when I try to collapse the expanded node, not when the node is expanded???

Could you please provide us any kind of sample where we can reproduce this issue? (You can send such example directly to the support@dhtmlx.com)


The following is the code for onOpenEnd().  Does it look correct?



this.attachEvent(“onOpenEnd”,function(id){
  this._redrawLines(id)
 });

This code is correct. “this” should be reference to the dhmlxGrid object.