DHTMLX Grid : Sorting of column which can contain combinatio

Hi,

I have a query that if my grid’s column is containing data like “S103850” then how to sort it ???

If you want to sort them by numeric part it can be done by using custom sorting functionality
    dhtmlx.com/docs/products/dhtmlxG … d_art_sort

function custom=function(a,b,order){  
        a=parseInt(a.toString().substr(0));
        b=parseInt(b.toString().substr(0));
        return (a>b?1:-1)*(order==“asc”?1:-1);
}

grid.setColSorting(“custom”);

Will this work for all columns or for A PARTICULAR column ???
I want to have it for certain columns only.

The setColSroting command assigns sorting types to columns of grid, so you can assing necessary types to necessary columns

grid.setColSorting(“str,custom,str,str”);

In such case only second column will have custom sorting functionality.

Hi,
    But suppose I have a column that can contain characters and integers in any order, then how to sort it ???
    Please help.
    Thanks in advance.

The default sorting type
    str
will sort all values as strings , which will work for any type of value.
By using custom sorting you can implement any sorting rule, I’m not sure which result you expect for sorting such mixed value.

Hi,
    Suppose I have values like in a column:

    AB43534543
    546656aadsa
    @#ffdgf54354
    esdadsadsdsd
    213213321

   According to our requirements, it should first show
  
   @#ffdgf54354
   213213321
   546656aadsa
   AB43534543
   esdadsadsdsd

   then how to achieve it ???
   Please help.

Default “str” rule will work very similar to your case
1217594116.zip (84.6 KB)