Skip to main content
A sort is a list of { column, direction } in priority order. It lives in the view, so it is saved with the view and written to the URL.

In the grid

The header shows the direction of each sorted column and sets aria-sort.

Natural direction

A column starts at its natural direction: descending for numbers and dates, ascending for everything else. The column menu labels follow the same rule, High to low for numbers and A to Z for text.

Sorting from code

sort.ts
compileSort(sorts, schema, context) and sortRows(rows, sorts, schema, context) in tally-core sort an array outside a grid.

Order

  • Each column type compares its own values. Enum columns sort in option order, not by label.
  • Empty values sort last in both directions.
  • sortable: false on a column removes the sort items from its column menu.
When the source has no sort capability, the grid sorts the rows the source returned. The SQL adapters follow the same order, see the semantics in Node.

Sorting and live rows

When the view is sorted and not grouped, a row changed by a live patch moves to its new position without a reload. See Live updates.