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

SearchPanel Filtered Event Trigger

6 Answers 348 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Piotr
Top achievements
Rank 1
Piotr asked on 27 Feb 2017, 10:15 AM
I have RadGridView with SearchPanel set to Visible and IsSearchingDeferred to True. Everything works fine, but I also have Filtered event on GridView and it calculate values for Items on selected page for one column. Event doesn't work for SearchPanel filter and SearchPanel doesn't have own event for this. Is there any way to make it works?

6 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 01 Mar 2017, 03:44 PM
Hi Piotr,

The reported behavior would be the expected one. The Filtering event is raised only when the user filters the control through the UI. For your requirement, you can utilize the CollectionChanged event of the FilterDescriptors collection of RadGridView.

Can you please give the suggestion a try and let me know how it goes?

Best Regards,
Stefan X1
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Piotr
Top achievements
Rank 1
answered on 11 May 2017, 11:51 AM

Thank you for your answer.

The solution actually launches the event 2 times with different e.Action = ... so you can easily capture one of them. Unfortunately, it has a drawback: the event is fired before updating ItemSource (QueryableCollectionView) - I need to update items that are currently in the visible list.

Filtered / Sorted events are fired after the ItemSource (QueryableCollectionView) update.

Do you have any suggestions?

Regards.


0
Stefan
Telerik team
answered on 16 May 2017, 06:05 AM
Hi Piotr,

Thanks for the clarification.

Since you are using a QCV as a source collection, you should be able to utilize its CollectionChanged event for this requirement.

Would such an approach be feasible for you?

Regards,
Stefan X1
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Piotr
Top achievements
Rank 1
answered on 16 May 2017, 06:40 AM

I found the reason of problem. Method in CollectionChanged was calling MyRadGridView?.Rebind() (for the present values) and this one sometimes was cause exception of modyfication ObservableCollection object.

I resolved the problem in this way:

private void MyRadGridViewFilterDescriptors_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)         

{             

     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)

   {

          this.Dispatcher.BeginInvoke(new Action(RefresrList), System.Windows.Threading.DispatcherPriority.Background);     

   }

}

 

private async void RefresrList()        

 {             

await MyRadGridView_VM.RefreshList();         

}

0
Piotr
Top achievements
Rank 1
answered on 16 May 2017, 06:43 AM

I found that TowarRadGridView?.Rebind();  cause the esception of modyfication ObservableCollection object.

I solved this by calling this.Dispatcher.BeginInvoke(new Action(RefreshTowarList), System.Windows.Threading.DispatcherPriority.Background);  in CollectionChanged event andt this works fine now :)

0
Stefan
Telerik team
answered on 17 May 2017, 07:58 AM
Hello  Piotr,

I am happy that you've managed to find a solution that suits your needs.

In case any other assistance with our components is needed, feel free to contact us again.

All the best,
Stefan X1
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Piotr
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Piotr
Top achievements
Rank 1
Share this question
or