Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tejas Shah on Oct 07, 2008 08:38
open dhtmlx forum
DHX Grid: Does sortRows work with custom sorting routine ??

Hi there,
Does sortRows work with custom sorting routine ??
I tried it AFTER loadXML (as I want to sort after grid is loaded), but its not working

function int_custom(a,b,ord){
                         a=a.toString().replace(/<[^>]*>/g,"")*1;
                         b=b.toString().replace(/<[^>]*>/g,"")*1;
                         return (a>b?1:-1)*(ord=="asc"?1:-1);
                 }

Is this correct ? Please help.
Answer posted by Support on Oct 07, 2008 09:23
>>Does sortRows work with custom sorting routine ??
It  works exactly the same as default sourting routine, you can use 

grid.sortRows(1,"int_custom","asc");

>>I tried it AFTER loadXML 
loadXML is async., you need to call code only after data loaded ( second parameter of loadXML command or onXLE event )