Skip to main content

sortBy Properties

PropertyTypeDefaultDescription
sortByarray[]Array of sort definitions applied in order. The first entry is the primary sort; subsequent entries break ties.
sortBy[].columnIdstringNone(required) Dot-separated binding path to the column that should be sorted. Must match a column key defined in the columns section.
sortBy[].directionstring"asc"(optional) Sort direction. Supported values: "asc" (ascending), "desc" (descending).

Sort Behavior

BehaviorDescription
Client-sideSorting is applied in the browser after data is loaded
Multi-columnMultiple sort entries are supported; order in the array determines priority
Default directionIf direction is omitted, "asc" is used
Interactive overrideUsers can click column headers to change sort direction at runtime
Default sort persistenceThe configured sortBy is always re-applied as a secondary sort after user-initiated sorts to maintain hierarchical stability

Sort Flow

diagram

Basic Sort

Sort by a single column in ascending order:
sortBy:
  - columnId: outlineNumber
    direction: asc

Multi-Column Sort

Sort by primary column, then by secondary column for rows with equal primary values:
sortBy:
  - columnId: outlineNumber
    direction: asc
  - columnId: title
    direction: asc

Descending Sort

sortBy:
  - columnId: severity
    direction: desc

Column-Level Sort

Individual columns can also specify a default sort direction via the sort column property. This is applied in addition to the global sortBy configuration.
PropertyTypeDefaultDescription
columns.*.sortstringNoneDefault sort direction for this specific column. Values: "asc", "desc".
columns:
  outlineNumber:
    title: "#"
    width: 80
    sort: asc
Use the top-level sortBy for the primary sheet sort order. Use the column-level sort property when a specific column should always maintain a particular direction as a secondary sort criterion.

Interactive Sort

Users can sort interactively in the sheet:
ActionResult
Click column header sort iconSort by that column (toggles ascending/descending)
Ctrl+Click column headerAdd column to existing multi-column sort
Reset sort (toolbar)Remove user-applied sorts and restore sortBy default
Sort state indicators appear in column headers showing the current sort direction. Multi-column sort shows small numbers indicating sort priority.

Sort Type Behavior

Column TypeSort Behavior
Text (string)Alphabetical sort
EnumSort by enum value sequence, not alphabetically
ReferenceSort by display value of the referenced entity
WorkflowSort by transition display text
Custom renderSort by the rendered display value

Complete YAML Example

sortBy:
  - columnId: outlineNumber
    direction: asc

columns:
  outlineNumber:
    title: "#"
    width: 80
    sort: asc
  title:
    title: User Need
    width: 200
    hasFocus: true
  systemRequirements.systemRequirement.title:
    title: System Requirement
    width: 180
    columnGroup: sysReq
  systemRequirements.systemRequirement.severity:
    title: Severity
    width: 100
    columnGroup: sysReq

columnGroups:
  sysReq:
    groupName: System Requirements
    groupStyle: darkblue
    headerStyle: blue
    collapseTo: systemRequirements.systemRequirement.title

sources:
  - id: main
    title: RTM
    model: rtm
    query:
      from: UserNeed
      where: <WHERE>
    expand:
      - name: systemRequirements
        title: System Requirements

Source references: sortBy Configuration Guide KB article, powersheet.yaml, whole_rtm.template.yaml, sorting.spec.ts
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/cypress/e2e/Sheet/reference.spec.ts
  • prod-powersheet-src/com.nextedy.powersheet.client/ltc-repo/cypress/e2e/Sheet/sorting.spec.ts
  • powersheet.yaml