Total Sum - Footer template

Hello!

I tried to do this example here:

Is there a footer-template in Blazor? (Radzen)

Also i wanted to use ${result.value.map(p=>p.UnitPrice).reduce((a, b) => a + b)} for displaying a total in a label - with no success.

Is this eaven possible now in blazor or is it still in developement?

Thank you! Regards!

Hi @chackl,

This is still not added to Blazor however we will do our best to provide column footers in the update.

Just released Radzen.Blazor 1.0.12 with FooterTemplate added for DataGrid columns. Demo added as well:
https://blazor.radzen.com/datagrid-footer-totals

Nice!

any plans if this also will be available in radzen?

Yes, we will release Radzen update before the end of this week. The feature is already in the master branch:

2 Likes

Hi, i try to do something like the post of Enchav with the demo and the grid with FooterTemplate but its dont work :
I have a grid :

And i try to add footer like this :

This compiles even if there is an error, but I can not access my page.

The only thing that works is this bizare mix :
<RadzenGridColum .....>
<Template....>
<RadzenButton .../>
<FooterTemplate " >
<RadzenFooter ">
Total : 20
</RadzenFooter">
</FooterTemplate">
</Template">
</RadzenGridColumn">

But the standard grid footer and scroolbar vertical has disappeared :

Can you help me pls ?
thx
Rth Benjamin

Can we have a Global Footer ? Independent of any Column?

Hey @zmp2000,

You can always place a component just below the DataGrid.

Yes but the pagination would be in the middle of it

@enchev This is not really a good solution for adding table totals. You are directly taking totals from datasource, what if there is a filter on the table?

You might need to run end test the demo. View property of the DataGrid will respect filtering.

1 Like

You are right, I just tested what you said. Cheers!

However, the demo on (Blazor DataGrid footer totals) is calculating freight in footer using orders.Sum(o => o.Freight). It should be calculated by ordersGrid.View.Sum(o => o.Freight). That had me confused.

This is a matter of developer preference - wether they want to display totals for the current "view" (page, filter) or the entire data. We think the latter is more common.

I think we should have a third option for totals. That will be total of "entire data - excluded data(by filters)". That will be the more common preference.
Let's say one wants to see sales/purchases in totality entire data will cater to that but if we filter it by region, it has to fit in the view of no. of pages selected or we can't see the total without exporting/copying to excel.
Another way to do this: Filter event which will filter datasource according to filter.

Totals are computed by the developer. It is up to decide how to calculate them.

@korchen true. Please tell me how can I calculate the scenario i mentioned

Hey @Tanveer_Khan,

As we already noted you can either use the variable bound to the DataGrid Data property or DataGrid View property. The rest is up to your case - you can write whatever LINQ expression.

1 Like