Filters

Filter sheet, operators, submission, and applied filter chips

Filters are defined in table structure (structureFilters). Users edit them in a Sheet side panel; applied values live in Redux and are sent on every data query.

UI components

ComponentFileRole
FilterTrigger./ApiTables/core/FilterTrigger.tsxButton to open/close filter panel
TableFilters./ApiTables/core/TableFilters.tsxSheet + react-hook-form fields
AppliedFilters./ApiTables/core/AppliedFilters.tsxRemovable chips for active filters

ApiTablesComponent only mounts TableFilters when structureFilters.length > 0.

Application flow

Two Redux representations

StateShapeUsed for
appliedFiltersObject keyed by filter_nameAPI filters field
renderedFiltersArray of { key, value, label, operator, ... }Chip UI

Do not confuse them — chips read renderedFilters; the fetcher reads appliedFilters.

Filter types (structure type)

Implemented in ./ApiTables/core/TableFilters.tsx:

typeControlNotes
dateDatePickerSupports pair_with ranges; formatted dd-MM-yyyy
textInputOptional numeric key filtering on input
numberInputNumeric validation
selectSelectOptions from props.select_options
booleanSelectTreated like select
nullSelectPlaceholder-style filters
multi_selectMultiSelect or TagsInputIf selectOptions use MultiSelect; else tags with comma / in operator split on submit

range type exists in structure types but is filtered out of the active form UI.

Operators

When props.operators.length > 1, a secondary operator field is rendered ({filter_name}_operator in the form).

On submit, transformObject / restructureSelectedFilters merge operator into the filter entry.

Labels for operators use useUtilTranslatorgetOperatorLabel (i18n keys under General: exact, like, greaterOrEqual, lessOrEqual).

Common operator symbols: =, like, >=, <=.

Submit rules

  • Submit enabled when any watched field has value (string non-empty, date range from, array length, etc.)
  • Only dirty fields (react-hook-form dirtyFields) are included in restructureSelectedFilters
  • Submit dispatches _setCurrentPage(1) so filters always restart at page 1

Removing a chip

AppliedFilters.handleClearRenderedFilters:

  1. Clears matching form field via setValue / resetField
  2. Recomputes renderedFilters and appliedFilters
  3. Triggers refetch via Redux update

Query payload

// ./ApiTables/hooks/useTableFetcher.ts
data: {
  perPage: pageSize,
  page: currentPage,
  filters: appliedFilters,
  sorts: tableSorting,
  params: { ... },
}

Backend must accept the object shape your filters produce (including operator fields per filter key).

On this page