Skip to main content

Configure Default Sort Order

Add a top-level sortBy array to your risksheet.json containing column IDs in priority sequence:
{
  "sortBy": ["severity", "rpn"],
  "columns": [
    { "id": "severity", "header": "Severity", "binding": "severity", "type": "enum" },
    { "id": "rpn", "header": "RPN", "binding": "rpn", "type": "int", "formula": "commonRpn" }
  ]
}
The grid sorts by the first column ID on load, then uses subsequent columns as tiebreakers for equal values.

Sort Descending

Prefix a column ID with ~ (tilde) to sort that column in descending order:
{
  "sortBy": ["~rpn", "priority"]
}
This sorts by RPN descending (highest risk first), then by priority ascending.

Sort by Outline Number

To maintain the same item order as in the Polarion LiveDoc, sort by outline number. Because outline numbers sort lexicographically by default (1.10 before 1.2), you need a server-rendered column that zero-pads each segment. Step 1 — Add a hidden server-rendered column that formats the outline number:
{
  "id": "outlineSort",
  "header": "Outline",
  "binding": "outlineNumber",
  "serverRender": "#set($on=$item.fields.outlineNumber.get())#if($on)#foreach($s in $on.split('\\.'))$String.format('%05d',$Integer.parseInt($s))#if($foreach.hasNext).#end#end#end",
  "width": 0,
  "visible": false
}
Step 2 — Set the column as the default sort:
{
  "sortBy": ["outlineSort"]
}
Without zero-padding, outline numbers sort lexicographically: 1.10 comes before 1.2. The Velocity snippet pads each segment to five digits (00001.00002), ensuring 1.2 correctly sorts before 1.10.

Interactive Sorting

Users can sort columns at runtime by clicking column headers:
  • Single click on a column header sorts ascending
  • Click again on the same header to switch to descending
  • Ctrl+Click (Windows/Linux) or Cmd+Click (macOS) adds the column as a secondary sort criterion without clearing the existing sort
When column headers span multiple columns (using columnSpan), clicking the merged header does not trigger sorting. Click individual sub-column headers instead.

Sorting Behavior by Column Type

Risksheet applies specialized sorting logic automatically based on column type:
Column TypeSort Behavior
string, enumAlphabetical
int, floatNumeric
itemLink, taskLinkAlphanumeric work item ID sorting (PROJECT-2 before PROJECT-10)
multiItemLinkConcatenates all linked item labels, sorts alphabetically
Outline number bindingHierarchical sort (1.2 before 1.10)
Nested propertiesSorts by the linked item’s property value, not the link itself
Sort behavior for custom serverRender columns depends on the rendered output format. Test sorting after adding server-rendered columns.

Comparison Mode Constraints

When comparing to a baseline, Risksheet enforces specific sorting rules:
  • The grid automatically sorts by Item ID then Revision number — this cannot be overridden
  • Task and downstream columns cannot be sorted in comparison mode
  • Sorting operates on baseline snapshot values rather than current values (except for system identity fields like systemItemId and systemItemRevision)
Entering comparison mode removes any task column sort criteria and applies mandatory Item ID + Revision sorting. Your previous sort order is not preserved when you enter or exit comparison mode.

Automatic Behaviors

Risksheet handles several sorting details automatically:
  • Pending edits are saved before sorting occurs — you will not lose unsaved changes when clicking a header
  • Client-side execution — sorting, filtering, and pagination happen in the browser without server round-trips, providing immediate visual feedback
  • Unsaved items (prefixed with *) sort with the asterisk intact, keeping newly created items visible

Verify

After configuring sortBy, reload the Risksheet page. The grid should display rows in the specified order on initial load. Click column headers to confirm interactive sorting works and verify that Ctrl/Cmd+Click enables multi-column sorting.

See Also

KB ArticlesSupport TicketsSource Code
  • RiskItemsODataCollectionView.ts
  • SortManager.ts
  • AppConfig.ts
  • PolarionAppConfigManager.java
  • risksheet.json