Selection Mode
Introduction
Section titled “Introduction”Selection Mode makes a List Filter behave like
Excel’s AutoFilter. Readers who live in spreadsheets expect two things the
default set filter doesn’t do, and turning on excelMode supplies both:
- You can’t apply an empty filter. In a plain set filter, unticking every
value and applying matches nothing (
in []) and the grid goes blank. Excel never lets you do that — deselecting everything and applying simply clears the column filter, showing every row, and reopening the popup shows all values ticked again. - “Add current selection to filter”. While the search box has text, an extra checkbox appears. It controls whether pressing Enter (or ticking “Select all search results”) adds the matches to the current selection instead of replacing it — so you can build a selection up across several searches, exactly like Excel.
It’s the excelMode option on the enterprise setFilter() helper — set it to
'windows' or 'mac':
import { setFilter } from '@zengrid/enterprise';
setFilter({ field: 'region', header: 'Region', excelMode: 'windows', // or 'mac'});Windows vs. Mac
Section titled “Windows vs. Mac”Both modes share the two behaviours above; they differ only in the default state of the “Add current selection to filter” checkbox, matching each platform’s Excel:
'windows'— the checkbox starts off, so a fresh search replaces the selection. Search, Enter, and only those matches are selected.'mac'— the checkbox starts on, so searches combine: searchEU, Enter, clear, searchUS, Enter, and both the EU-* and US-* regions end up selected. Untick the checkbox any time to switch back to replace.
Can’t apply an empty filter
Section titled “Can’t apply an empty filter”This is the headline difference. With excelMode set, the value list’s empty
state is treated as “no filter” rather than “match nothing”:
| Action in the popup | Default set filter | Selection Mode |
|---|---|---|
| Untick every value, Apply | Grid shows no rows (in []) |
Filter cleared, every row shown |
| Reopen after that | Everything unticked | Everything ticked again |
Because Excel always starts fully selected, defaultToNothingSelected is
ignored when excelMode is set — the value list opens with everything
checked regardless.
Add current selection to filter
Section titled “Add current selection to filter”Type in the search box and the Add current selection to filter row appears
above the list, and the (Select all) row relabels to (Select all search
results) so it’s clear it only spans the matches. With the checkbox ticked,
Enter / “Select all search results” unions the visible matches into whatever
was already selected; unticked, it replaces the selection with just the
matches. Mac mode ticks it by default, Windows leaves it clear.
Try it live
Section titled “Try it live”Open a column’s funnel and interact with its value list. Deselect everything and Apply to see the “no empty filter” behaviour; type in the search box and press Enter to see replace vs. union. Each variant configures Selection Mode differently.
Open the Region funnel: untick (Select all) then Apply — the grid keeps ALL rows (an empty filter is treated as no filter), and reopening shows everything ticked again. Search "EU" and press Enter — because Windows replaces, only the EU-* regions stay selected.
Options reference
Section titled “Options reference”| Option | What it does |
|---|---|
excelMode |
'windows' or 'mac' — turn on Excel-style behaviour. Omit for the default set filter. |
| — empty selection | Treated as no filter (all rows) instead of in []. |
— 'windows' |
“Add current selection to filter” starts off → Enter replaces the selection. |
— 'mac' |
“Add current selection to filter” starts on → Enter unions into the selection. |
— defaultToNothingSelected |
Ignored while excelMode is set (Excel always opens fully selected). |
Every other List Filter option (values,
valueFormatter, comparator, miniFilter, showCount, treeList) applies
alongside Selection Mode.
- List Filter — the checkbox filter Selection Mode
tunes, and how a selection maps to an
incondition. - Filter Search — the search box the “Add current selection to filter” behaviour builds on.
- Value List — supplying, sorting and formatting the values the list shows.