WarUI

Programmatic Sort API

GRID-A09-F14P0baselinePlanned

Methods let application code read, set, modify and clear the sort without simulating clicks. Typical uses are toolbar presets and resetting views. All methods share one sortModel contract, and changes made through the API fire the same events as user interaction, marked with the source 'api'.

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

The employee grid with a toolbar of preset buttons and a live JSON view of the sortModel.

Expected behavior

Clicking a preset updates the rows, the indicators and the JSON view together. Invalid JSON entries are rejected with an inline error, and the grid keeps its previous sort.

Planned API surface

api.getSortModelapi.setSortModelapi.applySortapi.clearSortapi.getColumnSortapi.setColumnSort

Acceptance criteria

  • setSortModel replaces the whole model, while applySort merges changes into it (pending)
  • getSortModel returns a defensive copy (pending)
  • clearSort empties the model and restores the base order (pending)
  • API calls fire onSortChanged with source='api' (pending)
  • Calling setSortModel with an identical model is a no-op and fires no event (pending)