WarUI

Sort by Accessor Different from Displayed Value

GRID-A09-F12P0baselinePlanned

A column can show formatted text while sorting by a different underlying value. For example, the column displays 'Mar 2024' but sorts by a timestamp, or displays a user's full name but sorts by surname. sortValueGetter defines the value used for sorting, independently of the display value and of valueFormatter.

Planned. This page shows the specification from issue #186. The live example, source for every framework and the API reference replace it when the feature ships.

Live example

A grid with Candidate (shows title and full name, sorts by surname), Applied (shows 'Mar 2024', sorts by timestamp) and Size (shows '1.2 MB', sorts by bytes).

Expected behavior

With the sort getter enabled, Candidate sorts by surname. With it disabled, the column sorts by displayed text, so 'Dr.' and 'Mr.' prefixes group the rows. The debug column shows the actual values compared.

Planned API surface

columns[].sortValueGettercolumns[].valueGettercolumns[].valueFormattercolumns[].field

Acceptance criteria

  • Resolution order for the sort value: sortValueGetter, then valueGetter, then field (pending)
  • valueFormatter output is never used for sorting unless sortByFormattedValue=true (pending)
  • Sort values are computed once per row for each sort operation (cached) (pending)
  • The cache is invalidated when the row data changes (pending)