I have a dropdown limit to list column which has a code value and a display value. So say 1 maps to Val1, 2 maps to Val2, and so on. In the grid I see Val1, Val2 - and in the data is stored 1,2 and so on.
If I group on that column, it is grouping on the data value - so it will say "SomeColumn: 1 (2 items)". It should really say "SomeColumn: Val1 (2 items)".
Is there any way to do this? The codes are meaningless to the users, the users need to see the display values.
I've got it now! My ValueLists were set per cell, not per column.
If I correctly understand the initial problem, I also have it:In a grid with an integer "Status" column having a ValueList attached to display text descriptions of the status, if I group on this column, the numbers are shown in the group area of the grid, not the description texts. I would like to have the texts instead.
You speak afterwards about datafilters and sorting and I cannot follow you guys ...
I have NetAdvantage for .NET 2008 Vol.1.
Hi Marinka,
Sorry, what I said "phases" I mean the conversions.
The issue isn't whether the grid CAN sort on the display text. The issue is that the grid sorts on the value by default. It only sorts on the Display text when the editor for that column tells it to - there's a ComparesByValue property on the editor. This property is overridable, and it's overriden on certain editors like EditorWithCombo, because then the editor is converting data values to display text, youwould want to sort on DisplayText.
In this case, you are not using a ValueList, you are using a DataFilter. But the grid can't know what you are using the data filter for. So it can't make the assumption that you want to sort on text and not value. So you can handle this yourself via a SortComparer. Anotehr solution would be to derive your own editor and override ComparesByValue.
Well, the idea is that the datafilter implementation decides on whether anything needs to happen. In fact, for dropdown columns it does nothing. But for other types of columns it sometimes needs to force some of its own formatting.
The data filter doesn't have phases it can handle or not handle as far as I know (that's the draw filter).
At the end of it all, the cells all have a display value that is rendered in the cell - maybe that value came from the data filter and Handled = True, or maybe the data filter said Handled = False and the grid found the appropriate value to put in the cell, or maybe there was no data filter. In all scenarios, the grid ended up with a value it displayed to the user for each cell - so surely it can sort on that (since it does in some scenarios).
After I realized what was causing the issue I submitted it to support, and it has been logged for developer review. The developer may see it the same way as you do - though to me, it shouldn't matter how the display value was figured out. Once the grid knows what string is being displayed in the cell, it should sort on that.
Thanks for your help!
I don't think this is a bug.
The grid has to make certain choices about whether to sort by value or by display text based on what it knows. For example, a column displaying numeric data should always sort by value regardless of how that data is formatted. You don't want numeric data formatted like a string.
If you have a ValueList attached to a column, then the column sorts by display text on the assumption that you are probably using the value list to convert data values into display texts.
When you have a DataFilter on a column, the grid doesn't have any idea what your data filter does, which phases it handles, or what your code is doing. So it probably just falls back to sorting by value.
My guess is that if you are using a DataFilter and want to sort by text, you will have to implement an IComparer class and set the SortComparer on the column.