Boolean Filter
The Boolean Filter adds dedicated, valueless operators for columns whose source values are boolean primitives. By default, users see Yes and No in the advanced-filter popup.
Add AdvanceFilterPlugin, then assign FILTER_BOOLEAN to the column:
import { AdvanceFilterPlugin, FILTER_BOOLEAN,} from '@revolist/revogrid-pro';
grid.plugins = [AdvanceFilterPlugin];grid.columns = [ { name: 'Enabled', prop: 'enabled', filter: [FILTER_BOOLEAN], },];
grid.source = [ { enabled: true }, { enabled: false },];The string form is equivalent:
{ name: 'Enabled', prop: 'enabled', filter: ['boolean'],}Operators
Section titled “Operators”The displayed names and stored operator keys are intentionally separate:
| Default name | Operator key | Matches |
|---|---|---|
| Yes | isTrue | The boolean primitive true |
| No | isFalse | The boolean primitive false |
The filter uses strict boolean matching. Values such as 'true', 'false',
1, 0, null, and undefined are not coerced into boolean matches.
Customize Yes and No
Section titled “Customize Yes and No”Use defineAdvancedFilterConfig to change the displayed operator names. The
operator keys remain isTrue and isFalse, so saved filter models and matching
behavior do not change.
import { defineAdvancedFilterConfig,} from '@revolist/revogrid-pro';
grid.filter = defineAdvancedFilterConfig({ localization: { filterNames: { isTrue: 'Enabled', isFalse: 'Disabled', }, },});Labels can use any application-specific wording, such as Active / Inactive
or localized translations.
Programmatic filter model
Section titled “Programmatic filter model”Use the stable operator keys when restoring or sending a filter model:
grid.filter = defineAdvancedFilterConfig({ multiFilterItems: { enabled: [ { id: 0, type: 'isTrue', relation: 'and', }, ], },});