Filtered grid row total amount (footer)

When we filter a grid, it doesn't show the filtered amount in the footer (e.g. sum of the remaining five elements when filtering for 'Chevalier') but always to total unfiltered amount, so this component cannot be used in real-world scenarios in most cases.

see https://blazor.radzen.com/datagrid-footer-totals

Any idea how to achive that?

Cheers,
Volker

You can use View similar to first column to sum only filtered data only.

Please provide a code-snipped for the footer-template to achive this.

THANK YOU, Vladimir!

Hey @Foizman,

Check my previous reply. If you are looking for dedicated support the options are here:

@Foizman again check my previous reply. Check the source code of the first column footer where the View is used (filtered records) instead all data.

I'm talking about a one-line snippet of code and you want to sell a license. Well, that's what I call business-minded.

Thank you for the crucial point, was really easy :smile:

Be it as it may, thank you very much for the exceptionally good support from Radzen, not joking!

You do this in an exemplary manner, not to mention: Compared to Syncfusion & Co., your support is definitely benchmark and best practice!

Cheers,
FM

3 Likes

Bother, You're my Brother!!!
You Just Made my Day!!!!
Love you From Pakistan , You Single Line of Code Sinpet Just helped me very Much...
Sorry for RIP English, A Very Very Little Junior Programmer...
BTW My Name is Owais, Love From PAKISTAN!!!!

1 Like

In my blazor server .net8 app using
grid0.View.Sum() in the datagrid
causes "A second operation started on this context before a previous operation completed."
Any thoughts, without being sarcastic like Foizman?

Try to use transient lifetime for the DbContext or ToList():

Thank you, but the issue here was my desire to simplify. I had previously made some Get{Entity}ById() generic:

public async Task GetAccidentById(int id) => await GetByIdAsync(id, i => i.AccidentKind, i => i.Machinery);

private async Task GetByIdAsync(int id, params Expression<Func<T, object>> includes) where T : class, IIdentifiable
{
var items = Context.Set()
.AsNoTracking()
.Where(e => e.Id == id);
foreach (var include in includes)
items = items.Include(include);
var itemToReturn = await items.FirstOrDefaultAsync();

return itemToReturn;

}