Filtering
Attach a filter control to any column: a text substring box, a numeric range, a single-value select, a set checkbox list, a date from/to pair, or a multi-condition conditions builder (operator + value, AND/OR). Filtering prunes the tree but keeps ancestor paths — a matching group stays reachable through its parents — and the engine’s aggregates are never recomputed on the client.
from dash_tensor_grid import TensorGrid, build_grid
# `filters` sets each column's filterType; the component renders the matching control.payload = build_grid(sales, { "rows": ["region", "country"], "measures": {"revenue": "sum", "qty": "sum"}, "formats": {"revenue": "currency:USD", "qty": "number:0"}, "filters": { "region": "set", # checkbox list of distinct values "country": "text", # substring box "revenue": "range", # numeric min/max },})TensorGrid(id="grid", row_data=payload["row_data"], column_defs=payload["column_defs"])import { TensorGrid } from '@tensorgrid/react';
<TensorGrid data={data} rows={['region', 'country']} measures={{ revenue: 'sum', qty: 'sum' }} enableColumnFilters // filter row under the header rootFilter="set" // root-dimension control: text | select | set | conditions | date/>;<TensorGrid :data="data" :rows="['region', 'country']" :measures="{ revenue: 'sum', qty: 'sum' }" enable-column-filters root-filter="set"/>import { mountTensorGrid } from '@tensorgrid/vanilla';import { columnFilterPredicate } from '@tensorgrid/core';
const grid = mountTensorGrid(document.getElementById('grid'), { data, rows: ['region', 'country'], measures: { revenue: 'sum', qty: 'sum' },});
// Drive per-column filtering with the core predicate (ancestor paths kept):grid.setFilter(columnFilterPredicate({ region: { type: 'set', value: ['EMEA', 'APAC'] }, revenue: { type: 'range', min: 50 },}));Options
Section titled “Options”- Filter types —
text(substring),range({min, max}),select(one value),set({value: [...]}checkboxes),date({min, max}ISO dates),conditions(operator + value, optionaljoin: and/orwith a second condition). - Ancestors preserved. A leaf match keeps its whole subtree and every parent path, so a deep hit is never orphaned. Multiple column filters AND together.
- Client-derived value lists for
set/selectcome from the column’s distinct values; in server mode the engine supplies them — see faceted filters. - For a single box that searches every row dimension at once, use the quick / global filter; to filter on an aggregated measure use having.