Hi,
I am using custom sorting to sort a date column which has some attributes. However, there are several date columns in the grid. I have noticed that the signature of custom sorting methods are: customsort = function (a,b, order, aid, bid).
Now I notice that some examples in custom sorting use gridinstance.cells(aid, hardcoded column number) eg: mygrid(aid, 1).getAttribute(“attrName”)
Since, I have multiple date columns, I cannot use hardcoded column numbers. Is there a way to obtain the column number on which the sorting is happening in the custom sort method.
Himanshu
Unfortunately there is no simple way to detect column number from custom sorting function, but you can use next trick
var index = 0;
function customsort(a,b,c,d,e){
alert("sorted by "+index);
}
mygrid.attachEvent(“onBeforeSorting”,function(ind){
index = ind;
return true;
});
The event will fire before custom sorting and will save column index in global var, which can be accessed from sorting function.