I have a model that has an enum field, and it is correctly displayed/edited/filtered.
The issue I am having is trying to set the default filter for the grid when it is first loaded. I have tried the following commands, with no success:
.Filterable(filtering => filtering.Filters(filters => filters.Add(e => e.Status).Equals(StatusEnum.Active)))
.Filterable(filtering => filtering.Filters(filters => filters.Add(e => e.Status).Equals(1)))
.Filterable(filtering => filtering.Filters(filters => filters.Add(e => e.Status).Equals(
"1"
)))
All of the above result in the following parameters being sent to the controller, and receiving a 500 server error:
Parameters application/x-www-form-urlencoded
filter Status~eq~
page 1
Am I missing something, or is this just missing from the featureset at the moment?
Steve
5 Answers, 1 is accepted
If I produce a demo project that demonstrates the bug is that likely to get it resolved?
Thanks for your help :)
Steve
We are not sure what may be causing this behavior. Providing a sample project would indeed help us a lot.
All the best,Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Please find attached a sample project which demonstrates the described issue.
Thanks.
Steve
The problem is that you are using EqualsTo which is the default implementation coming from the Object class. You need to use IsEqualTo:
.Filterable(filtering => filtering.Filters(filters => filters.Add(e => e.Status).IsEqualTo(DefaultEnumFilter.Models.ProductStatus.Ordered)))
Atanas Korchev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Many thanks Atanas.
Steve