Check documentation for the latest version of dhtmlxSuite setCustomSorting DHTMLX Docs

setCustomSorting

sets a custom sorting

void setCustomSorting(function func,number col);
funcfunctionthe function used for comparison
colnumberthe index of a column to apply the custom sorting to

Available only in PRO Edition

Example

//the second column is sorted by the number of symbols in the text
mygrid.setCustomSorting(sort_custom,1);
...
function sort_custom(a,b,order){
    var n=a.length;
    var m=b.length;
    if(order=="asc")
        return n>m?1:-1;
    else
        return n<m?1:-1;
}

Details

the custom sort has three params:valueA,valueB,order; where the order can be "asc" or "des"

Back to top