pass subgrid into its onKeyPress event

I have a subgrid and am attaching an event to it:



subgrid.attachEvent(“onKeyPress”,doOnSubGridKeyPress);



when the event is raised, how can I determine which subgrid raised it?



function doOnSubGridKeyPress(code,ctrl,shift)

{



// i can do something like this but if the parent grid row

// is not selected, then this fails

var subgrid = grid.cells(grid.getSelectedRowId(),0).getSubGrid();

}



is it possible to pass in the subgrid into the event?



subgrid.attachEvent(“onKeyPress”,doOnSubGridKeyPress(subgrid));



i tried the above but it didnt work.

“this” will point to the grid instance, this is work for all events.
function doOnSubGridKeyPress(code,ctrl,shift)
{
var subgrid = this;
}