Column footer
A column footer pins a grand-total row below the scroll area so the whole-frame aggregate for each measure stays visible while you scroll and expand. It is computed over the source frame (the engine’s true grand total, not a client-side sum of pre-aggregated leaves, which would give a mean-of-means), and it stays put through the windowed re-render of a virtualized grid.
from dash_tensor_grid import GridDataEngine, TensorGrid, build_payload
# Compute the footer with the engine so tree mode gets the true whole-frame totals.engine = GridDataEngine(sales)payload = build_payload(engine, { "rows": ["region", "country"], "measures": {"revenue": "sum", "qty": "sum"}, "formats": {"revenue": "currency:USD", "qty": "number:0"},})TensorGrid( id="grid", row_data=payload["row_data"], column_defs=payload["column_defs"], show_footer=True, footer=engine.column_footer({"revenue": "sum", "qty": "sum"}),)<TensorGrid data={data} rows={['region', 'country']} measures={{ revenue: 'sum', qty: 'sum' }} formats={{ revenue: '$0,0', qty: '0,0' }} showFooter footerLabel="Grand total"/>;<TensorGrid :data="data" :rows="['region', 'country']" :measures="{ revenue: 'sum', qty: 'sum' }" :formats="{ revenue: '$0,0', qty: '0,0' }" show-footer footer-label="Grand total"/>mountTensorGrid(el, { data, rows: ['region', 'country'], measures: { revenue: 'sum', qty: 'sum' }, formats: { revenue: '$0,0', qty: '0,0' }, showFooter: true, footerLabel: 'Grand total',});- The engine owns the totals. The JS adapters derive the footer via the core whole-frame aggregate;
in Dash you pass explicit
footervalues (hereengine.column_footer(...)), so a tree-mode grid shows the correct grand total rather than an average of subtotals. footerLabel(adapters) / the footer’s group cell names the row (default “Total”).- The footer sticks to the bottom of the scroll container and is re-applied after each virtualized render, so it never scrolls out of view. It also works on the virtualized grid.
- Want a total row inside the tree instead of a pinned footer? Use
grandTotalon aggregation, or a pinned column to keep the label column frozen on horizontal scroll.