Telerik Forums
UI for WinUI Forum
0 answers
99 views

Hi

I have a Datagrid and on double click on an row a detail view for this row is loaded. And when clicking the back button the datagrid view is loaded again. The Viewmodel behind the datagrid is a singleton, so the data is still there.

Now what I want is to preserve the filters of the grid so that a user can set a filter, double click an entry, click the back button and has the filter still set and the data still filtered.

Its a bit tricky but i can do that with Text- and DateTimeFilters by saving the Datagrids Filterdescriptors in the Viewmodel in the OnNavigatedFrom event and setting a cloned version of them in the OnNavigatedTo Event.

But I see no possibility for DistinctValueFilterDescriptors because the actual Data is set in the filter.

Is there a better way to save and load the filter state of a grid?

Hans
Top achievements
Rank 1
 asked on 21 Jul 2023
0 answers
111 views

Hi

I am using the Datagrid with Data Virtualization and I need to implement server side filtering.

So I added the "FilterRequested" command to get the information on how the user wants to filter. I then persist the filters in my viewmodel, clear all data in the datagrids itemsource, send a request to the server and refill the itemsource with the first <batchsize> of the filtered rows.  All following requests to the server (e.g.. throug scolling) will use the persisted filter values (and I do the same for sorting). This kind of works so far.

My Problem: I have a column that represents a state in form of an enum. Out of the box I can only filter for distinct states that are in the grid right now, but there are potentially more states in rows that have not been loaded yet. Is there a way to override the distinct filter options with static ones (in my case all enum values)? Even if there is an override, it is probably not possible to figure out which values were selected, because the DistinctValuesFilterDescriptor that is delivered via the FilterRequestContext of the command just gives me all elements that would be left after the filter, not the values selected.

kind regards
Dominik

Dominik
Top achievements
Rank 1
 asked on 29 Jul 2022
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?