Get event id

Hello,

to detach an event i must have the id

grid.detachEvent(id);

But: How can i get this event id?
There’s no function like getEventId({name of event}). :astonished:

Best regards, Carsten

The attachEvent method returns id

var id = grid.attachEvent("onRowSelected", some_code); ... grid.detachEvent(id);

Yes, i know that, but we have some JS basic routines to init a grid and we attach some events like this in the basic functions:

grid.attachEvent("onRowSelected", some_code);

In one case i would like to change an event but before i must detach the old event. So i must know the id of this old event for detach. So i miss/missed a function like

grid.getEventId("onRowSelected");

grid can have multiple handlers attached to the same event, so there is no way to get the event id in such way.

You can use code like next to clear all events from onRowSelected ( but this is kind of hack, and not a part of public API )

delete mygrid.ev_ononrowselected;