Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Steve Schreiner on Oct 02, 2008 09:52
open dhtmlx forum
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.
Answer posted by Support on Oct 02, 2008 10:05
"this" will point to the grid instance, this is work for all events. 
function doOnSubGridKeyPress(code,ctrl,shift) 

var subgrid = this;
}