Skip to main content
A filter is part of the view. It is a typed AST that the filter bar edits, the URL stores and the data source runs. Every filter can be written as query language text.

The filter bar

The default toolbar of <Tally> renders the filter bar. Type a query and press Enter. Suggestions come from suggest in tally-core: columns, the operators that fit the column, and the values present in the data. A query that does not parse shows its first error under the input and changes nothing. When the ai prop has an ask handler, text that does not parse or reads like a sentence goes to the handler instead. See Ask.

Filtering from code

The view store sets the filter. Parse text with parseQuery, or build the AST with condition, and, or, not and search.
filter.ts
setFilter(undefined) clears the filter. A change to the filter reloads the grid and returns to the first page. To show the current filter as text, print it with printQuery:
filter-text.tsx

Flags

is:name is a flag. The grid resolves is:changed itself, for rows with cells changed by a live patch. Every other name goes to the flags option of the grid. These options go to useGrid or createGrid. On the server, flags are SQL expressions: see the flags option in Node and Laravel.

Column options

Where the filter runs

The grid sends the filter to the source when the source has the filter capability. Otherwise it filters the rows the source returned. Search falls back to the grid when the source lacks the search capability. Flags always run in the grid.
A filter that runs in the grid only sees the loaded rows. With a paged source that cannot filter, rows on other pages are not matched.