Skip to Content

ListingFilters

A collapsible panel rendered above the listing table. It maps an array of FilterField configs to filter inputs via RenderFilterFields, manages local filter state, and on submit pushes a new URL query string so the active filters are shareable and bookmarkable.

Key capabilities:

  • Filter presets: visible fields are persisted per-user in the KVS store.
  • Default filter values: also persisted in KVS, layered on top of the hardcoded defaultFilters prop.
  • Range filters: numeric, date, and select fields support min/max range mode.
  • Search strategies: text fields can expose Exact / Contains / Starts With / Ends With selectors.
  • Tree filter: when hasTreeView is true, a tree hierarchy picker appears to scope the listing to a subtree. See Tree View for the hierarchy options and the query parameters they produce.

Import

import ListingFilters from "@phpcreation/frontend-crud-react-nextjs-bundle/components/Listing/Filters";

Props

PropTypeRequiredDescription
fqcn_buiIFQCN_BUIYesUsed for element IDs and KVS keys.
resourcestringYesAPI resource name, also used to key the KVS filter state.
filterFieldsFilterField[]YesArray of filter field definitions.
tenantstringYesTenant identifier.
defaultFiltersRecord<string, any>NoHard-coded filters always applied as base values.
localestringNoActive locale, defaults to "en".
hasTreeViewbooleanNoEnables the tree hierarchy selector within the filter panel.
userUser | nullNoUsed to scope KVS reads to the current user.

FilterField — filter-specific properties

Beyond the base FilterField shape, these properties are handled by ListingFilters:

PropertyTypeDescription
defaultbooleanIf true, the field is visible without expanding “Show all filters”.
rangebooleanRender a min/max range variant of the field.
rangeKeys{ min: string; max: string }Custom query-string keys for the range bounds.
searchMethodsstring[]E.g. ["exact", "partial", "start", "end"] — shows a strategy selector.

Filter priority order (highest wins): URL query string → KVS saved values → defaultFilters prop → FilterField.defaultValue.


Usage

import ListingFilters from "@phpcreation/frontend-crud-react-nextjs-bundle/components/Listing/Filters"; <ListingFilters fqcn_bui={{ Bundle: "BillBundle", Unit: "Invoice", Interface: "filters" }} resource="invoices" filterFields={[ { key: "status", type: ColumnTypeEnum.SELECT_ASYNC, targetResourceAsync: "statuses", default: true }, { key: "createdAt", type: ColumnTypeEnum.DATE, range: true, default: true }, { key: "total", type: ColumnTypeEnum.CURRENCY, range: true }, ]} defaultFilters={{ "order[createdAt]": "DESC" }} tenant="acme" locale="en" />

Last updated on