Find out which element throws onButtonClick

Hi,

how can i find out (or get GridObject) which DhtmlxGrid calls/throws the onButtonClick event?

function onButtonClick(menuitemId, type) {
[…]
return true;
}

menu = new dhtmlXMenuObject();
menu.attachEvent(“onClick”, onButtonClick);
[…]
niceGrid[i].enableContextMenu(menu);
niceGrid[i].attachEvent(“onBeforeContextMenu”, my_pre_func);

Hi,

“this” inside event handler is the object of the component. Therefore, the approach could be the following:

[code]var activeGrid ;
function onButtonClick(menuitemId, type) {
var grid = activeGrid;
[…]
return true;
}
function my_pre_func(rId,cInd){
activeGrid = this;
[…]
return true
}

menu = new dhtmlXMenuObject();
menu.attachEvent(“onClick”, onButtonClick);
[…]
niceGrid[i].enableContextMenu(menu);
niceGrid[i].attachEvent(“onBeforeContextMenu”, my_pre_func);[/code]