My users submitted the following "bug":
Clicking on column name to sort has a third “no sort” option, instead of just the ascending/descending sorts as expected.
Is it possible to disable the "no sort" option on a WinGrid?
Thanks,
Dmitriy.
Hi Dmitriy,
The WinGrid does not have functionality to allow a user to un-sort a column. Clicking a column header toggles the sorted state from ascending to descending and vice versa.
So if your grid is toggling to a third state where the data is unsorted, then something in your code must be doing that.
Just created a sample application and dragged a WinGrid (v 8.1) on the Form. Then I went to UltraWinGrid Designer -> Feature Picker -> Header Click Sort Action. There are 3 DummyColumns in the Preview pane. Clicking first time on the DummyColumn 0's header sorts the column ascending (arrow up). Clicking it the second time sorts the column descending (arrow down). Clicking it the third time removes the sorting on the column (no arrow).Can I disable the third state and leave just asc/desc options?
Thanks,Dmitriy.
Those are just dummy columns in the designer. The grid does not do that at run-time with real columns at run-time.
Mike,
You're right. The code goes into a great length to add the third sorting state. Apparently, it was done according to users' request. Now the users want to remove it. Most probably they do not really realize of what they're asking. The usual stuff...
HI Mike I want a diferent kind of sorting. I am preferrably calling it as 3-way sorting.
The three way sorting as per my requirement is One is in ascending (indicated by up arrow), one is descending(indicated by down arrow) and another one is Absolute descending(preferabbly indicated by a + sign).
I hope you understand the requirement, I will also give an example. If my values are -6000, 5000, 5500 then
Absolute decending is something like -6000, 5500 , 5000.
Can you tell me how should Iget this done on UltraGrid. and also is it possible to enable this kind of sorting only for few specific columns in the grid.
Thanks in Advance,
Sanjeev.
Hi Sanjeev,
There's no built-in functionality for this in the grid.
You might be able to achieve this in a number of ways. The approach I would take is to use a CreationFilter and replace the existing SortIndicator in the column header with an element of my own. Then you can make it display however you want.
To handle the actual sorting, you would need a SortComparer on the column which knows about the three different sorts and handles each one.
The SortComparer would not be very difficult to do, but the CreationFilter could be pretty tricky, especially if you are not familiar with UIElements and CreationFilters already.