multi grid and events

Hello,



In my page, i use two grids. When a event is sent on a grid, i don’t know in which grid i am. When i’m in a function attached on custom sorting i don’t know which grid is sorting. I can’t imagine, i must write a function for each grid.



Thanks

Inside event handler, “this” always points to the grid object, for which event was called

mygrid.attachEvent(“onEditCell”,function(){
// this == mygrid
})

But it’s not true in a function of custom sorting. How can i know in which grid i’m in this case?

Thanks

There is no way to detect such info in case of custom sorting.
If you really need it , then

var currentGrid=null;
var setGrid = function(){ currentGrid = this; return true; }
mygrid1.attachEvent(“onBeforeSorting”,setGrid)
mygrid2.attachEvent(“onBeforeSorting”,setGrid)

now, inside custom sorting method you will be able to access currentGrid variable.