Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.27k stars 530 forks source link

DataGrid: Include a way to add DataGridAgregates with multiple rows #4349

Open yanezricardo opened 1 year ago

yanezricardo commented 1 year ago

I am migrating a legacy software that includes several Data Grids, some of this has aggregates with multiples rows. The HTML resulting is like following

<table>
   <thead>.. </thead>
   <tbody>.. </tbody>
   <tfoot>
      <tr>..</tr>
      <tr>..</tr>
   <tfoot>
</table>

It would be nice if we can do this with Blazorise DataGrid, I tried to do the same adding multiple DataGridAgregates, but the library takes the last one

<DataGridAggregates>
    <DataGridAggregate TItem="SaleDto" Field="@(nameof(SaleDto.Exports))">
        <DisplayTemplate>
            <strong>Ventas totales</strong>
        </DisplayTemplate>
    </DataGridAggregate>
    <DataGridAggregate TItem="SaleDto" Field="@(nameof(SaleDto.Total))" Aggregate="DataGridAggregateType.Sum" DisplayFormat="{0:N0}"  DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("es-CL")">                                
    </DataGridAggregate>
</DataGridAggregates>
<DataGridAggregates>
    <DataGridAggregate TItem="SaleDto" Field="@(nameof(SaleDto.Exports))">
        <DisplayTemplate>
            <strong>Promedio</strong>
        </DisplayTemplate>
    </DataGridAggregate>
    <DataGridAggregate TItem="SaleDto" Field="@(nameof(SaleDto.Total))" Aggregate="DataGridAggregateType.Average" DisplayFormat="{0:N0}" DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("es-CL")">
    </DataGridAggregate>
</DataGridAggregates>
stsrki commented 1 year ago

You can only have one DataGridAggregates which will translate to one footer row. We don't have plans at the moment to support more.