WarUI

Type-Aware Default Comparators

GRID-A09-F07P0baselinePlanned

The grid selects a comparator from the column's data type. Numbers compare numerically, dates compare chronologically, booleans place false before true in ascending order, and strings use collation. This prevents common mistakes such as '100' sorting before '9'. The cellDataType setting declares the type explicitly; without it the grid infers the type from sample values.

Planned. This page shows the specification from issue #186. The live example, source for every framework and the API reference replace it when the feature ships.

Live example

An inventory grid with Quantity (number), Restocked (Date objects and ISO strings), InStock (boolean) and SKU (string).

Expected behavior

Quantity sorts 2, 9, 10, 100. When forced to string, it sorts '10', '100', '2', '9', which demonstrates the difference. Mixed Date and ISO values sort chronologically. InStock ascending shows false rows first.

Planned API surface

columns[].cellDataTypeinferDataTypesbuiltInComparators.numberbuiltInComparators.datebuiltInComparators.booleanbuiltInComparators.string

Acceptance criteria

  • The number comparator orders values numerically, including negative numbers and decimals (pending)
  • The date comparator accepts Date objects, ISO-8601 strings and epoch milliseconds (pending)
  • The boolean comparator orders false before true in ascending order (pending)
  • An explicit cellDataType overrides inference (pending)
  • Inference samples a documented number of non-empty values and falls back to string when values are ambiguous (pending)