Skip to content
Data TableExamples

Column filtering and sorting

comins-table@0.2.2React

Control text, number, date, and boolean filters while retaining filters and source data after sorting.

Each preset replaces the complete filter model. Sorting retains the filter. Use a header filter button to edit conditions directly.

Action Visible rows
Initial state Alpha, Beta, Gamma, Delta
Name starts with g Gamma — text comparison is case-insensitive by default.
Amount 100–200 Alpha(120), Delta(160) — inclusive endpoints.
Joined in February Beta, Gamma — UTC calendar dates.
Active AND amount > 150 Gamma, Delta — rules for different columns combine with AND.
Amount 100–200 → Amount descending Delta, Alpha — retains the filter model and original row array.
Reset Clears all filters and sorting.
  1. Set columns[].filter.kind for each value type. This example provides stable column and row IDs.
  2. Own columnFiltering.model and openColumnId in React state.
  3. onChangeModel supplies the complete next model; onChangeOpenColumnId supplies the next open column ID or null. Connect both to their state setters.
  4. Pass source data unchanged. The package projects matching rows and then sorts the result.

Filtering is controlled. Do not add a sortModel prop to this version’s CominsTable. The sort button calls ref.setSortModel() and onChangeSortModel observes changes. The displayed sort JSON comes from that notification.

Open the Name header’s filter icon, enter zz in Value, and see the empty result update immediately. Escape closes the editor. Reset reveals all four original rows.

  • Pass numbers for numeric between values and exact YYYY-MM-DD strings for date values. This does not compare a datetime’s local calendar date as written.
  • Source data is unchanged. Filtering and sorting affect the visible projection.
  • This is a CSR flat-data example. Do not combine it with Tree, remote Viewport, Infinite Scroll, or Lazy Load. Row Drag is unavailable when columnFiltering exists.
  • Row Grouping, Summary Row, and exhaustive operator combinations remain separate example work.

Column filtering · Sort ref method · Selection and sorting state