dhtmlXGrid - server side sorting when multiple grids on the

I have a page on which I use multiple grids. The data for these grids is held server side and sorting happens here too. There are potentially many thousands of rows so I need to keep the data server side. I have followed the example to create a server side sortable grid using the onBeforeSorting event and processing with javascript as follows



function sortGridOnServer(ind,gridObj,direct){

mygrid.clearAll();        

mygrid.loadXML(gridQString+(gridQString.indexOf("?")>=0?"&":"?")+“orderby=”+ind+"&direct="+direct);

mygrid.setSortImgState(true,ind,direct);

return false;

}



This works fine when there is a single grid on the page. When I have multiple grids, I cannot have a single javascript event handler to process the sorting event. The issue is that the sorting event handler does not know which grid to sort (myGrid is global and gets overwritten each time a new grid is created). The documentation indicates that the second parameter to the event handler is the “grid object” but in fact it appears to be the value set in the setColSorting method for the column being sorted.



Is there any way for the event handler method to find out which grid is requiring sorting.



I am using version 1.6 professional of the grid control.



Many Thanks.



Is there any way for the event handler method to find out which grid is requiring sorting.
Inside any event handler “this” points to the related object.

mygrid.attachEvent(“onBeforeSorting”,sortGridOnServer);

function sortGridOnServer(ind,gridObj,direct){
    this.clearAll();
    this.loadXML(…

});