Categories | Question details Back To List | ||
Change default onclick sort order We are using the professional edition version 1.5 build 80111 and would like to find a way to change the default onclick sort order from Ascending to Descending. Meaning the first time you click a column header, it sorts the data in Ascending order. I would like to change the first click to be Descending. Do you have a built in API to handle this or should a custom sort order be built for this? Thanks for your help and continue to build excellent products. Answer posted by Support on May 02, 2008 01:51 Basically it can be done in few different ways a) you can define custom sorting with revertive order mygrid.setColSorting("custom"); function custom(a,b,order){ return (a>b?1:-1)*(order=="asc"?-1:1); } b) you can define onbeforesort event handler and change the sorting order from it. mygrid.attachEvent("onBeforeSorting",function(a,b,c){ if (c=="asc") { this.sortRows(a,b,"des"); return false; } return true; }) |