Option demo

Sort by operational priority

This incident queue uses JavaScript options when sorting rules need functions: custom parser order, a custom state sorter, domain labels, and a visible status region.

Scenario

Review support incidents before standup

Priority and impact use numeric parser maps, while State uses a custom sorter so active incidents appear before waiting or resolved work.

customParsers customSorters labels statusElement allowUnsort

Try it

Use custom order, not alphabetic order

Example

Incident queue

Sort status will appear here.

Scroll horizontally to view all incident columns.

Active support incident queue
INC-2048 Sev 1 Global Investigating 42 min
INC-2047 Sev 3 Team Waiting 2 hr
INC-2046 Sev 2 Region Mitigating 75 min
INC-2045 Sev 1 Region Resolved 4 hr 20 min
INC-2044 Sev 4 Single user Investigating 18 min

Developer notes

Options used in JavaScript

const instance = createSortableTable(table, {
  statusElement: "#incident-sort-status",
  allowUnsort: true,
  customParsers: {
    priority(value) {
      return { "sev 1": 1, "sev 2": 2, "sev 3": 3, "sev 4": 4 }[value.toLowerCase()] ?? 99;
    },
    impact(value) {
      return { global: 1, region: 2, team: 3, "single user": 4 }[value.toLowerCase()] ?? 99;
    }
  },
  customSorters: {
    state(rowA, rowB, context) {
      return stateOrder(context.getValue(rowA)) - stateOrder(context.getValue(rowB));
    }
  },
  labels: {
    sortedBy: "Incident queue sorted by {label}, {direction}.",
    unsorted: "Incident queue returned to original order for {label}."
  }
});

Accessibility notes

What to inspect

Custom labels

Labels change status announcements without changing the table's semantic structure or keyboard interaction.

Visible status

The status element is visible and polite, so sighted testers and assistive technology users can confirm the same state change.

Limitation

Custom sort functions should stay deterministic and should not depend on visual-only state.