Hi,
I have an MVC grid that uses a DataSourceUrl to get a JsonResult from the controller. When I try to filter by a field that is based on an Enum, the controller crashes with the error "Argument types do not match" when trying to retrieve the filtered data.
What is the correct way to filter by enums in the grids?
Here is a quick example of how I'm doing this:
Hi Paul,
Thank you for submitting this product idea.
If you have any questions or concerns, please let me know.
Submitted as a new product idea:
http://ideas.infragistics.com/forums/211535-ignite-ui/suggestions/4367136-iggrid-ability-to-filter-remotely-by-an-enum-col
Hi Nikolay,
Thanks for this suggestion. I will keep this in mind.
Paul
Hello,
I would suggest you to submit a new Product Idea at http://ideas.infragistics.com.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).
2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)
3. Add your product idea and be sure to be specific and provide as much detail as possible. Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Thanks for clarifying that. I've thought about not using GetData, but it already does a great job at Filtering/Sorting/Paging. To write my own methods for doing this doesn't seem worth it for just filtering enums.
I'd actually like to reference my original post and submit this as a bug. I don't think I should be receiving an error "Argument types do not match" when trying to filter an enum and using the GetData method. GetData should be able to filter an enum just like any other integer.
I don't think the issue is being able to serialize an Enum as a string instead of an int. When the view passes back the filter (in my example, the url has "filter(Field2)=equals(1)"), I think it is correct that the integer value is used. When the data access is done, it should be using the integer value to pull the field from the database (SQL database in my case). So it is probably a good thing that this is an integer.
Thanks,