Hello,
I have a column in a grid containing a enum. Sorting it does not go as I would want.
Enum:
public enum Priority { Low = 0, Medium = 1, High = 2 }
I want the column to sort on the enum value, not the text, so 0,1,2. Currently it's sorting Low -> High -> Medium instead of Low -> Medium -> High.
I have found the following article, which explains how to sort one column based on another column, which I can apply to this problem:http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7695
Is there no buildin way to sort an enum column on the value instead of text, instead of having to implement a comparer and stuff ?
Kind regards,
Michael
Hello Hristo,
Setting the type of my column solved the problem. Thanks for the quick reply !
I have tried your scenario, where for data source I’ve used DataTable object. My data table contains a column of type “Priority” (your enum type ), so when I click onto the column header in order to sort its cells , they are sorted correctly (Low-> Medium-> High ). Please see attached sample.
So I assume that your column is not of the proper type, and that is why sorting doesn’t works for you.
Please let me know if you have any further questions or if I am missing something.