Skip to content

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"])
  • Filter typestext (substring), range ({min, max}), select (one value), set ({value: [...]} checkboxes), date ({min, max} ISO dates), conditions (operator + value, optional join: and/or with 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 / select come 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.