Skip to content

Filters ​

Filters listed in config.filters appear in the Add filter dropdown. Users can add several, fill them in and click Load.

ts
filters: [
    {label: "Name", inputName: "name", type: "text"},
    {label: "Status", inputName: "status", type: "select", selectItems: [
        {key: "active", value: "Active"},
        {key: "blocked", value: "Blocked"},
    ]},
    {label: "Age", inputName: "age", type: "number-range"},
    {label: "Registered", inputName: "createdAt", type: "date-range"},
]

Options ​

OptionTypeDescription
labelstringShown in the dropdown and next to the input.
inputNamestringField name your backend filters on.
type'text' | 'select' | 'number-range' | 'date-range'Input type.
selectItems{key, value}[]Options for select. key is sent, value is shown.

Values sent to dataLoader ​

Each filter passed to dataLoader is your config object plus a value:

Typevalue
textstring the user typed
selectthe selected item's key
number-range{ from: string, to: string }
date-range{ from: 'YYYY-MM-DD', to: 'YYYY-MM-DD' }

Filters left empty (blank text, no select option chosen) are not sent.

The same filter type can be added more than once.

Sponsored by MobicardBusyBPC-InfoLinkTrust