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

Filter Dialog in RadGridView

3 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 11 Mar 2011, 08:41 PM
I would like to set the filter of a particular column of my RadGridView automatically after the grid is loaded with data.
However, I could not get the instance of the Filter Dialog and set it. How can I do that?

Currently I programmatically insert a ColumnFilterDescriptor into the RadGridView with the specified column
and set the filtering to what I wanted it to filter.

This will actually set the Filter Dialog however it does not do the filtering unless I Click the Filter button or make any
changes to the Filter Dialog that will trigger the reloading of the data. 

Please help me, many thanks

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 12 Mar 2011, 01:23 PM
Hi Peter,

May you provide a bit more details about the exact behavior you want to accomplish ? Do you want to pre-filter the grid as in this article ? Why do you want to access the filter dialog ? Generally, you need to work with the FilterDescriptors/ ColumnFilterDescriptors of the grid. 

 

Best wishes,
Maya
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Peter
Top achievements
Rank 1
answered on 14 Mar 2011, 05:10 PM
Hi,

I used a QueryableDomainServiceCollectionView  in the ViewMdoel and let myRadGridView.ItemsSource binding to the ViewModel. I would like to pre-set the filter at the UI side so when the data is loaded, it displayed filtered results.By pre-set the filter, I mean  I would like to pre-set the filter for a particular column that I want to filter in the RadGridView.

I did tried to add ColumnFilterDescriptor to the RadGridView by doing something like this:

ColumnFilterDescriptor cfd = new ColumnFilterDescriptor(column);  
myGridView.FilterDescriptors.Add(cfd);

I inserted the above code in RadGridView's Loaded event handler.
This actually changes the UI of the Grid (the funnel icon of the column changes to orange color, and the filter dialog has the value that I set. However, It does not update the data in the RadGridView, that is the data presented are the data before applying the filter. It doesn't seem to trigger the filter.

How can I trigger the filter to filter the data?

Thanks a lot.
0
Rossen Hristov
Telerik team
answered on 15 Mar 2011, 09:15 AM
Hi Peter,

Please, read my blog post, in case you have not.

You have to make sure that the QDSCV is AutoLoa=true, bind the RadGridView.ItemsSource to the QDSCV and then add the ColumnFilterDescriptor to the grid.

This is the same as the end user opening the filtering UI and clicking on a value.

I hope this helps. Let me know if there are problems.

Best wishes,
Ross
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Peter
Top achievements
Rank 1
Answers by
Maya
Telerik team
Peter
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or