Skip to content

feat: add unsort state on 3rd column header click - #841

Open
Rawi2115 wants to merge 1 commit into
icflorescu:nextfrom
Rawi2115:feature/unsort-column
Open

feat: add unsort state on 3rd column header click#841
Rawi2115 wants to merge 1 commit into
icflorescu:nextfrom
Rawi2115:feature/unsort-column

Conversation

@Rawi2115

Copy link
Copy Markdown

Sorting previously only toggled between two states per column: 1st click -> asc, 2nd click -> desc, 3rd click -> back to asc, with no way to fully clear a column's sort via the header.

Add a third click state that clears sorting instead of cycling back to ascending. unsorting happens by setting the columnAccessor in the sort status to an empty string ("")

Also updates the sorting example to explicitly handle the empty columnAccessor case, and adds a note to the sorting docs page explaining the new third-click behavior.

Fixes #812

Sorting previously only toggled between two states per column:
1st click -> asc, 2nd click -> desc, 3rd click -> back to asc,
with no way to fully clear a column's sort via the header.

Add a third click state that clears sorting instead of cycling
back to ascending. Following the pattern already used in a
community workaround for this request, unsorted is represented
with the existing DataTableSortStatus shape by setting
columnAccessor to an empty string, rather than changing the type
to allow undefined/null. This keeps direction always defined and
avoids touching every downstream consumer of sortStatus.

The header cell's existing icon logic already falls back to the
unsorted icon whenever sortStatus.columnAccessor doesn't match
the column's own accessor, so no rendering changes were needed
there - an empty-string sentinel naturally satisfies that check
for every column.

Also updates the sorting example to explicitly handle the empty
columnAccessor case, and adds a note to the sorting docs page
explaining the new third-click behavior.

Fixes icflorescu#812
@codesandbox

codesandbox Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

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.

1 participant