I have a requirement to filter some prices using pre-defined values like the following:
Less than £10
Between £10 and £20
Between £20 and £30
More than £30
I can't seem to see a way to do this with the Grid. Is it possible?
Thank you
Lucy
3 Answers, 1 is accepted
0
Viktor Tachev
Telerik team
answered on 07 Aug 2017, 12:03 PM
Hello Lucy,
Applying default filter for the Grid can be done by setting a filter condition in the DataSource. This way when the data is requested the filter will be applied and the Grid will show only the relevant information.
The code snippet below outlines how you can set the DataSource to filter records where the UnitPrice is between 10 and 20.
Sorry I didn't actually mean when the data is requested. I meant the pre-defined values show in the 'filter' box for UnitPrice. Then when you select one, it filters it.
Thank you
Lucy
0
Viktor Tachev
Telerik team
answered on 09 Aug 2017, 11:20 AM
Hello Lucy,
Thank you for clarifying the scenario. In that case the filter menu can be customized to include a DropDownList with predefined values. There is an example that shows how to customize the filter menu below.
Have in mind that the filter for the dataSource should be applied manually via the filter() method. This is necessary because each option in the DropDownList would have a different filter operator. You can use the change event of the DropDownList to set the filter.