Skip to main content

Define a Single-Column Sort

Add a sortBy array at the top level of your sheet configuration. Each entry specifies a columnId and optional direction:
sortBy:
  - columnId: outlineNumber
    direction: asc
PropertyRequiredDescriptionDefault
columnIdYesDot-separated binding path to the column to sort by
directionNoSort order: "asc" (ascending) or "desc" (descending)"asc"
The columnId value must match a binding path defined in your columns section.

Define Multi-Column Sort

Multiple entries in the sortBy array create a multi-column sort. Rows are sorted by the first column, then ties are broken by the second, and so on:
sortBy:
  - columnId: outlineNumber
    direction: asc
  - columnId: title
    direction: desc
diagram
Sorting is applied on the client side after data loads. The sort order specified in sortBy defines the initial view — users can change it interactively from the toolbar.

Sort by Navigation Properties

You can sort by columns that use navigation binding paths (columns bound to related entities):
sortBy:
  - columnId: systemRequirements.systemRequirement.title
    direction: asc
The columnId must be the exact binding path used in the columns section.

Per-Column Sort Property

Individual columns also support a sort property that defines a default sort direction for that specific column:
columns:
  outlineNumber:
    title: "#"
    width: 80
    sort: asc
The global sortBy array gives you explicit control over sort priority. The per-column sort property is applied in addition to the global sortBy configuration, which can lead to unexpected ordering if both are used.

Interactive Sorting

Users can interactively sort by clicking column headers. Powersheet supports these sort interactions:
  • Click a column header to sort by that column (toggles ascending/descending)
  • Ctrl+Click a column header to add it to the multi-column sort chain
  • Column headers display a visual sort direction indicator when active
The default sort from sortBy is always re-applied after user-initiated sorts to maintain hierarchy stability.

Complete Example

sortBy:
  - columnId: outlineNumber
    direction: asc

columns:
  outlineNumber:
    title: "#"
    width: 80
    isreadOnly: true
  title:
    title: Title
    width: 200
    hasFocus: true
  systemRequirements.systemRequirement.title:
    title: System Requirement
    width: 180

Verify

After saving the sheet configuration, reload the powersheet document. You should now see rows ordered according to the sortBy configuration. Column headers of sorted columns display sort direction indicators.

See also

KB ArticlesSource Code
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/whole_rtm.template.yaml
  • prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/mip_undo_redo.template.yaml
  • prod-powersheet-src/com.nextedy.powersheet.client/ltc-repo/packages/sheet/commands/sort-reset.ts
  • prod-powersheet-src/com.nextedy.powersheet.client/ltc-repo/cypress/e2e/Sheet/sorting.spec.ts
  • powersheet.yaml