Grid Sorting (Smart Rendering)

Hello,



I have attached a function “sortGridOnServer” as “onBeforeSorting”-event. Like you say in the tutorial I pass three parameters to the function: ind, gridObj, direct. Now the problem is, that the direct parameter is undefined, so the sorting doesnt work.

Can you help me out here?



Thx in advance, Martin


Sorry for the misleading information.There is a mistake in the documentation. “onBeforeSortin” handler should looks like that:


grid.attachEvent(“onBeforeSorting”,function(ind,type,direction){
this.clearAll(); // clear grid
this.loadXML(“some.url?direction=”+direction+"&ind="+ind); //load a new dataset from the server, with necessary order
this.setSortImgState(true,ind,direction); //set a correct sorting image
return false;
});




“direction” parameter in such case is a direction of a sorting (“des” or “asc”)


Note, that code will not sort grid on your server side. You should adjust your server side code that it will return rows in the necessary direction.

Hmmm … doesnt work. When I alert the “direction”-parameter within the function it still says “undefined”.