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

Custom filter based on calculate field

0 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 21 Aug 2015, 05:20 AM

Ok my requirement is simple and I am just getting lost in the various partial examples and forum posts on how to do this. What is surprising is I would expect this to be so standard there would hundreds of examples out there but I cannot find one.

 

I have a basic person model with properties to include a birthdate.  All of those properties are on a grid in a MVC 5 Razor view.  The grid is setup and works fine.  What I would like to do is keep the existing filter capability on the birthdate field but add four additional filters that signify age groupings, so one for under 11 years old, one for between 11 and 14, and one for between 14 and 18, and one for over 18.

 

Then of course since this is not a field in the actual database, I would need to do "custom server binding" as all the partial examples somewhat show. I have played with the datasourcerequest object in the past and I have no need to implement a fill blown custom binding scenario. Is it possible to just intercept these four requests, pull them out of the IFilterDescriptors, apply them manually, and then pass the remaining request object to the ToDataSourceResult method?

If so I have not seen this either. If someone could please guide me to the right area on this I would appreciate it. To sum up:

1. How do you add custom filters to the grid menu on a column but keep the default ones there?

2. Can you intercept these filters and pull them out of the filter descriptor collection?

3. How would you identify these custom filters to pull them out?

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Share this question
or