Repository navigation
DataGrid: column footers (summary row) — design proposal #5339
sebguischr
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi! Following up on #273 (closed in 2022) and on the suggestion in #5333 to discuss designs before writing code, here is a proposal for column footers in
FluentDataGrid, for instance to show totals below a column.Why now
In #273, the blocker was that the underlying web component had no footer. Since 4.11 the grid renders a native
<table>, so a<tfoot>(and a sticky variant withposition: sticky; bottom: 0, mirroring the sticky header) is straightforward. Today the workaround is to append a fake "totals" item toItems, which then gets sorted, paginated and selected like the other rows, and is announced by screen readers as a data row.Proposal: composition only, no data logic in the grid
ColumnBase.FooterTemplate(RenderFragment<ColumnBase<TGridItem>>?): the content of the column's footer cell. The app computes the values itself, since it knows whether they should cover the current page, the filtered data or everything.FluentDataGrid.GenerateFooter, mirroringGenerateHeader:Auto(the default: a footer is rendered only when a column has aFooterTemplate, so existing grids are unchanged),None,DefaultandSticky.<tfoot>with one cell per displayed column, following the column alignment, pinned columns andDisplayMode. Not rendered while loading or on error;aria-rowcountcounts it.Possible follow-up, only if wanted
Declarative aggregates (for example
Aggregate="DataGridAggregate.Sum"), computed on the unpaged query, plus a way for anItemsProviderto return them. Left out on purpose: it is more code to maintain, and templates already cover the need.Questions
FooterTemplate+GenerateFooter, or something else?Feedback from other users is very welcome too: how do you show totals in your grids today?
All reactions