DataGrid has Sorts property but not Filters property #1696

Closed
opened 2026-01-29 17:57:24 +00:00 by claunia · 2 comments
Owner

Originally created by @LegendOfLynkle on GitHub (Apr 1, 2025).

Is your feature request related to a problem? Please describe.
The DataGrid contains the Sorts property allowing you to get a list of Sort Descriptors for the table. There is however no equivalent that I can see for filters that exposes even a readonly view of FilterDescriptors used by the data grid when loading data. This means that it is somewhat awkward to get a list of sorts and filters to pass to the server for something like requesting a data export (obviously not much of a problem in the Blazor Server case).

Describe the solution you'd like
Consider adding a Filters property to the data grid to allow users to retrieve a list of the current FilterDescriptors being used by the table. Alternatively the underlying private IEnumerable<FilterDescriptor> filters could be converted into a regular property along the lines of IEnumerable<FilterDescriptor> Filters { get; private set; } = Enumerable.Empty<FilterDescriptor>().

Describe alternatives you've considered
Outside of something like this the main approach I can see for how you would do it currently is to just have a ref on each of the columns and then make the FilterDescriptors yourself since the DataGridColumn doesn't seem to create a FilterDescriptor anywhere.

Additional context
Since this is essentially a tiny change I figured I would open an issue rather than a pull request since DataGrid is one of the most used components. Additionally I'm not familiar enough with DataGrid's internals as to whether just providing a property that provides read access to the existing filters is wise/makes sense. Also not sure if it makes sense for Sorts to be an ObservableCollection whilst exposing Filters as an IEnumerable 🤔

Originally created by @LegendOfLynkle on GitHub (Apr 1, 2025). **Is your feature request related to a problem? Please describe.** The DataGrid contains the [Sorts](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenDataGrid-1.html#Radzen_Blazor_RadzenDataGrid_1_Sorts) property allowing you to get a list of Sort Descriptors for the table. There is however no equivalent that I can see for filters that exposes even a readonly view of FilterDescriptors used by the data grid when loading data. This means that it is somewhat awkward to get a list of sorts and filters to pass to the server for something like requesting a data export (obviously not much of a problem in the Blazor Server case). **Describe the solution you'd like** Consider adding a Filters property to the data grid to allow users to retrieve a list of the current FilterDescriptors being used by the table. Alternatively the underlying private `IEnumerable<FilterDescriptor> filters` could be converted into a regular property along the lines of `IEnumerable<FilterDescriptor> Filters { get; private set; } = Enumerable.Empty<FilterDescriptor>()`. **Describe alternatives you've considered** Outside of something like this the main approach I can see for how you would do it currently is to just have a ref on each of the columns and then make the FilterDescriptors yourself since the DataGridColumn doesn't seem to create a FilterDescriptor anywhere. **Additional context** Since this is essentially a tiny change I figured I would open an issue rather than a pull request since DataGrid is one of the most used components. Additionally I'm not familiar enough with DataGrid's internals as to whether just providing a property that provides read access to the existing `filters` is wise/makes sense. Also not sure if it makes sense for Sorts to be an ObservableCollection whilst exposing Filters as an IEnumerable 🤔
Author
Owner

@LegendOfLynkle commented on GitHub (Apr 4, 2025):

I didn't realise that I could probably just use the Settings property on data grid to get the sort of information for filters that I am after. That being said maybe it is still worth it having a matching Filters property to the existing Sorts property?

@LegendOfLynkle commented on GitHub (Apr 4, 2025): I didn't realise that I could probably just use the Settings property on data grid to get the sort of information for filters that I am after. That being said maybe it is still worth it having a matching Filters property to the existing Sorts property?
Author
Owner

@enchev commented on GitHub (Apr 7, 2025):

We don't plan to add such property since there are many other way to add/get filters - check our demos for reference.

@enchev commented on GitHub (Apr 7, 2025): We don't plan to add such property since there are many other way to add/get filters - check our demos for reference.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1696