View as Markdown

API reference: @salmonui/data-grid/engine/sort

rowComparatorfunction

import { rowComparator } from '@salmonui/data-grid/engine/sort';
function rowComparator<Row>(rows: readonly Row[], keys: readonly SortKey<Row>[], locale: string): (x: number, y: number) => number;

Comparator equal to the order sortRowOrder produces for an ascending input: sort keys, then source index. Reads codes and per-code values (and per-code ranks where they exist) without repairing ranks, so an incremental update never pays for rank maintenance: numeric keys compare directly (NaN first, like rank 0); strings compare by rank when both codes are ranked and by the locale collator otherwise (ranks are collator-consistent).