Single-Column Sorting by Header Click
Clicking a sortable column header sorts all rows by that column. A second click reverses the direction. Only one column is sorted at a time by default, so a new header click replaces the previous sort. This is the entry point for all other sorting features.
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 of 50 employees with Name, Department, Salary and Start Date columns, all sortable and none sorted.
Expected behavior
Clicking 'Salary' sorts it ascending and shows an up arrow. Clicking it again sorts descending. Clicking 'Name' clears the Salary sort and sorts by Name ascending. A non-sortable header ignores clicks and shows no hover affordance.
Planned API surface
columns[].sortabledefaultColDef.sortablesortModelonSortChangedaria-sortAcceptance criteria
- A click on a sortable header sets sortModel to exactly one entry for that column with direction 'asc' (pending)
- A second click on the same header changes the direction to 'desc' (pending)
- A click on a different header replaces the sortModel entry (pending)
- A header with sortable=false does not change sortModel when clicked (pending)
- The sorted header has aria-sort='ascending' or 'descending'. All other headers have aria-sort='none' or no aria-sort attribute (pending)
- Row order after sorting matches the expected order of the fixture data (pending)