How to maintain the Filter after ItemsSource Changes ?

Hello ,

In .net maui windows, I have DataGrid Binding to ObservableCollection of a class . Based on this article I was able apply filter

Filtering in .NET MAUI DataGrid control | Syncfusion


I have two scenario's  that needs Filtering to be maintain on the DataGrid irrespective of . The columns remain the same for both scenario's

1) When the Customer changes the List of Order are different but Filter would remain same on same columns

We would like to maintain the same filter after changing ItemSource in ViewModel

e

2) Customer remains the same but when Order Info is refreshed with updated data i.e. Status or Shipped Qty etc.,

For Both scenario's current behavior is The Filtering is lost and user had to re apply filter. How to maintain filter even if Item Source with changes on DataGrid with same set of Columns.


Is there any way to set the Filter from ViewModel ?


thanks




1 Reply

SD Sethupathy Devarajan Syncfusion Team September 26, 2024 11:41 AM UTC

Hi Praveen,


It is clear that you need to maintain filter logic when the ItemSource is changed. We have addressed your scenarios in the attached sample, where we filtered based on the order status, specifically 'Pending.' We have also shared the sample and a video demo for your reference.


If you have any misunderstandings or if your needs differ, please provide clear details about your use case. You can include additional information regarding the expected behavior. This extra detail will enable us to thoroughly address your request and provide an appropriate solution.


Regards,

Sethupathy D.


Attachment: SfDataGridSample_a851bca3.zip

Loader.
Up arrow icon