Skip to content

Selection & range

Ctrl/Cmd-click a row to toggle its selection; shift-click extends a contiguous range. The opt-in status bar summarizes the selection (count and per-measure sum / avg / min / max over the underlying source rows), and Ctrl/Cmd-C or the export button emits those source rows as CSV. The summary is computed by the engine over the real rows behind the selected nodes — the frontend does no math.

from dash import Input, Output, callback
from dash_tensor_grid import TensorGrid
# `selected_rows` is read-only output; `enable_range_selection` turns on marquee/block selection,
# and Ctrl/Cmd-C reports `clipboard_copy`. Drive an export from a callback via the `command` prop.
grid = TensorGrid(id="grid", row_data=..., column_defs=..., enable_range_selection=True)
@callback(Output("count", "children"), Input("grid", "selected_rows"), prevent_initial_call=True)
def on_select(rows):
return f"{len(rows or [])} selected"
  • Selecting a group selects its rows. A selected node resolves to the source rows beneath it, so the summary and export cover the whole subtree — synthetic nodes (grand total, “Others”) contribute nothing.
  • Range aggregation. showStatusBar runs the engine’s summarizeRows over the selected source rows; there’s no client-side re-summation of pre-aggregated leaves (which would give mean-of-means).
  • Copy / export the source, not the display. enableClipboard and exportMode: 'source' emit the raw underlying rows; use exportMode: 'aggregated' for the rolled-up view as shown. See export & scale.