DHTMLX Docs & Samples Explorer

setCustomSorting(func, col)

Required library edition: This method requires Professional Edition of the DHTMLX library
Required library file: dhtmlxgrid.js

set custom sorting (custom sort has three params - valueA,valueB,order; where order can be asc or des)

  • func - function to use for comparison
  • col - index of column to apply custom sorting to
   //second column is sorted by number of symbols in 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;
    }

See also: sortRows