Skip to content

feat(Grid): explicit sortField takes precedence over the displayed value when sorting - #1317

Merged
mstijak merged 3 commits into
masterfrom
fix/grid-sort-key-precedence
Jul 30, 2026
Merged

feat(Grid): explicit sortField takes precedence over the displayed value when sorting#1317
mstijak merged 3 commits into
masterfrom
fix/grid-sort-key-precedence

Conversation

@nebojsa-peric

Copy link
Copy Markdown
Collaborator

Fixes #1314

Implements the sort key precedence confirmed in #1314: sortValue > sortField > value > field.

A column that displays a computed value but defines an explicit sortField now sorts by the raw field instead of the displayed value. Behavior changes only for columns that define both sortField and value - all other combinations sort exactly as before.

  • Grid.tsx: apply the precedence in the three places that pick the sort key (header click, prepareData sorter fixup, renderHeader) and document the rule on GridColumnConfig.sortField / sortValue
  • docs: fix the Grid sorting example, which claimed field is kept for sorting next to a computed value, and document the precedence order

Builds on #1316 (repro in #1313).

…lue when sorting

Changes the sort key precedence from sortValue > value > sortField > field to
sortValue > sortField > value > field, so a column that displays a computed
value but defines an explicit sortField sorts by the raw field. Documents the
rule on GridColumnConfig.sortField/sortValue.

Behavior changes only for columns defining both sortField and value.
The example claimed field is kept for sorting next to a computed value, but
the displayed value takes precedence over field; an explicit sortField is
required to sort by raw data. Documents the full precedence order:
sortValue > sortField > value > field.
…s example

Unit tests render a grid and simulate header clicks to pin down the
sortValue > sortField > value > field precedence on both code paths
(header click and sorters restored from sortField/sortDirection bindings),
plus the single-column sort indicator. The litmus repro now states the
expected behavior and adds a sortValue column demonstrating the full chain.
@mstijak
mstijak merged commit 8053298 into master Jul 30, 2026
2 checks passed
@mstijak
mstijak deleted the fix/grid-sort-key-precedence branch July 30, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grid sorting misbehaves for columns using value instead of / together with field

2 participants