Clear Filtering

How to remove all the filters in Radzen Blazor Grid? Is there any way for example on clicking clear all the filters should be removed and the original grid displays.

1 Like

Reset() method will be added to the DataGrid component with next update (tomorrow).

3 Likes

Its working.. Thanks

Hello all,

in my grid I save the filter:
1)
var myFilter = args.Filters.Where(x => x.FilterValue != null).Select(x => new { Property = x.Property, FilterValue = x.FilterValue }).AsEnumerable().Select(c => new Tuple<string, string>(c.Property, c.FilterValue.ToString())).ToList();

and restore them
2)
foreach (var c in RadzenGrid.ColumnsCollection)
{
[...]
c.FilterValue = myFilter.Items2
}

this works fine.

Now I want to clear the filtering with

grid.Reset()

this will only Clear the user settings NOT the settings I set into the Code (see 2)
if I want to clean this, I have to do

foreach (var c in RadzenGrid.ColumnsCollection)
{
[...]
c.FilterValue = null;
}

Why?
And is there a easyer way to do this?

I also have this problem of Pinki. It's very annoying, because I can't properly restore the previously set filters so that then the user can also delete them normally. It only works for text filters, with others (e.g. dates) there is no longer any way for the user to delete a DateTime filter set from the beginning. Just look at your official example Free Blazor Components | 60+ controls by Radzen. At the beginning the grid is filtered correctly. Then if the user wants to clear the filter he has to open the filter popup and delete the text "Nan" and press "Apply", and this works. But if the user then clicks "Clear" returns the initial filter "Nan"! Surely this is not the behavior that the user expects! The "Clear" button should always clear the filter, and not restore the initial filter.

The initial filter is what is declared in the .razor not nothing. You can use this article to have both initial filtering and use Clear() to remove all filters. Just make sure you have latest Radzen.Blazor 3.13.10 since we've just fixed a problem related to clear filter behavior. We updated also our demo to avoid any further confusion.

Now the "Clear" button on DateTime filter works correctly as expected, thank you for the quick fix!

Thanks for fixing the DateTime. For us it works too.

But for INT columns we still have the problem. Please see this Post: