feat(Grid): explicit sortField takes precedence over the displayed value when sorting - #1317
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1314
Implements the sort key precedence confirmed in #1314:
sortValue>sortField>value>field.A column that displays a computed
valuebut defines an explicitsortFieldnow sorts by the raw field instead of the displayed value. Behavior changes only for columns that define bothsortFieldandvalue- all other combinations sort exactly as before.Grid.tsx: apply the precedence in the three places that pick the sort key (header click,prepareDatasorter fixup,renderHeader) and document the rule onGridColumnConfig.sortField/sortValuefieldis kept for sorting next to a computedvalue, and document the precedence orderBuilds on #1316 (repro in #1313).