This is a migrated thread and some comments may be shown as answers.

Force filtering to refresh when values in existing rows are updated

10 Answers 1076 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 1
Marcus asked on 06 Jun 2013, 09:14 AM
I have filtering enabled in my RadGridView column.  When an existing row has it's cell value updated for the filtered column, the row should be excluded if it's outside of the filter parameters - however, this is not the case.  I have to manually go back and adjust the filter for the row to be excluded.

How can I ensure that all current data in the grid is correctly filtered, even when cells are updated after the row is added?

10 Answers, 1 is accepted

Sort by
0
Marcus
Top achievements
Rank 1
answered on 07 Jun 2013, 10:24 AM
Hi,  any ideas on this?

thanks.
0
Nick
Telerik team
answered on 07 Jun 2013, 10:36 AM
Hi Marcus,

This seems a bit strange, the Grid should handle the change and exclude the item. May I ask to provide a bit more information on your project? Are there any customizations that could interfere with the default behavior? A sample project would be very nice! 
As a side note, you can try raising a CollectionChanged event for your ItemsSource after the edit with a status Reset, which will take care of the issue. 

Hope this helps! 

Regards,
Nik
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Nick
Telerik team
answered on 07 Jun 2013, 10:44 AM
Hello Marcus,

Just a quick follow-up. The grid view handles the change only on BeginEdit + EndEdit methods calls combination. 
You need to raise a collection change of any kind to enable the behavior otherwise. The easiest way is to add and remove a dummy object in your collection.

Hope this helps! 

Regards,
Nik
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Marcus
Top achievements
Rank 1
answered on 07 Jun 2013, 11:14 AM
I think I need to clarify - the cell values are updated asynchronously on the row model objects, and I raise a NotifyPropertyChanged event on the row for the relevant property. I'm not editing the grid itself. I would expect that when a row fires a NPC event for a filtered property, the filter should detect this and update?
0
Accepted
Rossen Hristov
Telerik team
answered on 07 Jun 2013, 11:23 AM
Hello,

Can we please keep all related forum posts in one thread, since as it appears that they discuss the same thing. Please, see my answer to your other forum post which asks the same. Thank you.

"I'm not editing the grid itself. I would expect that when a row fires a NPC event for a filtered property, the filter should detect this and update?"

It will not update for performance reasons and that is by design. We don't recreate a view which can contain millions of records simply because one of the properties of one of them has changed.

You have three options in order of preference:

1. BeginEdit -> EndEdit. Read my other post.
2. Remove your item from the collection, edit it, and then add it back again. We will determine whether it passes the filter and so on.
3. Call RadGridView.Rebind if you want to re-create the entire view and don't care about performance.

Now, I would like to ask you to keep our conversations in as little number of different threads as possible, since at the moment there are like 5 threads for one and the same subject and you are speaking with different support officers simultaneously and there is quite a lot of miscommunication, i.e. we are explaining the same thing in 3 different threads.

Thank you.

Regards,
Rossen Hristov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Marcus
Top achievements
Rank 1
answered on 07 Jun 2013, 03:07 PM
Thanks, I've gone with option 2.  All makes sense.

I would consider all my questions to actually be separate issues, hence the different threads.  This and the nested bindings questions perhaps overlap, but I considered this a filtering issue.  It just turns out they may be both fixed by the same underlying changes.
0
Doug
Top achievements
Rank 2
answered on 08 Jul 2016, 01:55 PM
This issue is very annoying.  We too use MVVM with a notify change event that updates the collection the gridview uses.  That updates the data just fine, but leaves the filters almost useless for real time data.  Please fix this.
0
Stefan Nenchev
Telerik team
answered on 13 Jul 2016, 08:27 AM
Hi Doug,

I am sorry to hear that the way the filtering mechanism is designed does not fulfill your project needs. Unfortunately, as my colleague has stated in the thread, we have decided to give priority to the performance of the filtering and updating the filters on PropertyChanged will be a costly operation in such perspective. With this in mind, I suggest you consider the options for bypassing the default behavior that discussed in the thread. 

Regards,
Stefan Nenchev
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Erhan
Top achievements
Rank 1
answered on 18 Sep 2018, 10:42 AM

Hi,

Add and remove not working, Filter still not working

 var dummyItem = new ResponseModel();
                  RecordList.Add(dummyItem);
                   RecordList.Remove(dummyItem);

RecordList is my ObservableCollection which binded my RadGridView.

0
Stefan
Telerik team
answered on 20 Sep 2018, 01:48 PM
Hello Erhan,

It is a bit strange that this approach does not work as it will force a CollectionChanged notification. What I can suggest you as an alternative that is not already discussed in this thread, is to use the Edititem method of the Items collection of RadGridView. The UI will be notified about the property value change and the filtering will be reapplied. Can you please take a look at the Edit an item outside RadGridView help article as it covers the approach in details?

I hope it helps.

Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Marcus
Top achievements
Rank 1
Answers by
Marcus
Top achievements
Rank 1
Nick
Telerik team
Rossen Hristov
Telerik team
Doug
Top achievements
Rank 2
Stefan Nenchev
Telerik team
Erhan
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or