javascriptsortinggriddhtmlxgridview-sorting

dhtmlxGrid How to select the value for sorting?


I've been playing with the filtering and sorting in dhtmlxGrid (https://dhtmlx.com/docs/products/dhtmlxGrid/samples/08_filtering/01_pro_filter.html) and I have a question: Can we sort the column with the employees' names by the last names without the changing the way they are written?

E.g.:

We have:

  1. Alex Calson

  2. David Edmond

  3. James Brightwood

And after sorting we want to have the names in this order:

  1. James Brightwood

  2. Alex Calson

  3. David Edmond

Is it possible?


Solution

  • The best way for you to reach the required functionality is to create a custom sorting function that will sort the column only by the second part of the value. Here you can find a tutorial:

    https://docs.dhtmlx.com/grid__sorting.html#customsortingfunction

    and a simple working example:

    http://snippet.dhtmlx.com/146a327f0