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

Default filter on enum column

5 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steve
Top achievements
Rank 1
Steve asked on 03 Aug 2011, 08:39 AM

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

Sort by
0
Steve
Top achievements
Rank 1
answered on 05 Aug 2011, 02:16 PM
Hey guys -  can I just get confirmation that this is a bug so I can release our latest version without it?

If I produce a demo project that demonstrates the bug is that likely to get it resolved?

Thanks for your help :)

Steve
0
Atanas Korchev
Telerik team
answered on 08 Aug 2011, 09:30 AM
Hello 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

0
Steve
Top achievements
Rank 1
answered on 23 Aug 2011, 04:32 AM
Atanas,

Please find attached a sample project which demonstrates the described issue.

Thanks.

Steve
0
Atanas Korchev
Telerik team
answered on 23 Aug 2011, 07:28 AM
Hi 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)))                


Find attached the updated project.

Regards,
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 >>

0
Steve
Top achievements
Rank 1
answered on 23 Aug 2011, 10:04 AM
Doh - that did the trick. I guess sometimes the problem is too obvious!

Many thanks Atanas.

Steve
Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Steve
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or