Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Totals and export

Since 0.1.0-alpha.24
Rows show the totals of their branches, the footer the totals of every match, and exports keep the tree's levels.

Totals and export

To show a row's total of the rows under it, such as a phase's hours, set RollUp on the column. The footer's Aggregate works as in a DataGrid, over every row the filters match.

Static

Preview

Estimate
Task
Owner
Hours
DiscoveryNadia Park40
Stakeholder interviewsNadia Park16
RequirementsOwen Clarke24
DesignIris Novak64
WireframesIris Novak20
BuildSam Ortiz128
LaunchOwen Clarke36
TestingOwen Clarke30
Release notesNadia Park6
Sum: 268

Code

Totals.razor
@* A project estimate: each phase shows the hours of the tasks under it, the footer the whole
   project's, and the export keeps the phases and tasks as an outline. *@
<TreeList Items="Estimate.All" ItemKey="w => w.Id.ToString()" ItemParentKey="w => w.ParentId?.ToString()"
          ItemExpanded="w => w.ParentId is null" Caption="Estimate" QueryPrefix="estimate-"
          ExportExcelHref="/examples/estimate.xlsx" ExportCsvHref="/examples/estimate.csv" Grow>
    <Columns>
        <PropertyColumn Property="w => w.Task" Filterable />
        <PropertyColumn Property="w => w.Owner" Filterable Width="10.Rem" />
        <PropertyColumn Property="w => w.Hours" RollUp="DataAggregate.Sum" Aggregate="DataAggregate.Sum" Width="8.Rem" />
    </Columns>
</TreeList>

A rolled-up row shows the sum, average, lowest, highest or count of the rows at the ends of its branch, the ones with nothing under them, so no value is counted twice. While filtering, it counts only the rows kept. It needs Items: with an ItemsProvider, give the rows their totals, and add a GroupsProvider for the footer.

The export keeps the tree: give the endpoint's DataExport.WriteExcelAsync or WriteCsvAsync a tree: DataExportTree<T>.Of(key, parent). Excel shows the levels as an outline, so the rows fold, and CSV indents the first column.

While filtering, the rows above a match come too. To write the rolled-up totals, add .RollUp("hours", DataAggregate.Sum) for each such column.

Connection lost

Rejoining the server…