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

Use Default Filtering Control with disabled Filter

2 Answers 94 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Moritz
Top achievements
Rank 1
Moritz asked on 14 Sep 2018, 10:13 AM

Hi,

 

I have a huge amount of data, which I don't want to load all into the gridview.

I want to have the following scenario: The user applies filter with the default filtering control. The ViewModel get the FilterDescriptor and request the filtered Data at the DataService. The GridView shows the received data.

I don't want to use the filter for filtering the data bound to the gridview, I want to use it to request filtered data.

 

Moritz

2 Answers, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 19 Sep 2018, 08:12 AM
Hello Moritz,

What I can suggest in order to achieve the desired result is to handle the Filtered event of the control and get ahold of the applied filter via the Added argument of the event.

You can then clear the filter by removing the corresponding MemberColumnFilterDescriptor from the control's FilterDescriptors collection. Here's what I have in mind:

private void RadGridView_Filtered(object sender, Telerik.Windows.Controls.GridView.GridViewFilteredEventArgs e)
{
    if (e.Added.Any())
    {
        var filter = e.Added.First() as FilterDescriptor;
        // use the FilterDescriptor to send the DataService request
 
        radGridView.FilterDescriptors.Remove(radGridView.FilterDescriptors.First(x => (x as MemberColumnFilterDescriptor)?.Member == filter.Member));
    }
}

Please let me know whether such an approach would work for you.

Regards,
Dilyan Traykov
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.
0
Moritz
Top achievements
Rank 1
answered on 17 Oct 2018, 01:29 PM
Thanks, that worked out for me.
Tags
GridView
Asked by
Moritz
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Moritz
Top achievements
Rank 1
Share this question
or