Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
885
Custom Three way Sorting on WinGrid
posted

Hi,

    I have  a use case which is explained as follows:

"I have a UltragGrid which has some 10 column. But I need two types of sorts for these columns. i.e Some columns need default sorting provided by UltraGrid, and some other columns requires Three Way Sorting."

Three Way Sorting in my point of view is:

  a. Ascendiing -Indicated by  default ascending SortIndicator.

  b. Descending- Indicated by default descending SortIndicator.

  c. Absolute Descending: shoudl be indicated by a + sign.

I am new to the Infragistics. Can anyone help me in getting this with a nice example.

Thanks very much in advance.

Sanjeev.

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Sanjeev,

    There's nothing like this built-in to the grid.

    There are basically three issues here:

    1) Sorting the grid in a custom order - this is very easy to do. You just need to write a custom IComparer class and assign it to the SortComparer property of the column.

    2) Showing a plus sign - this is a little more difficult. You would have to use a CreationFilter or a DrawFilter to replace the existing sort indicator in the column header with a different image.

    3) Toggling the sorting three ways - To do this, you would have to handle the events of the grid like BeforeSortChanged. When going from Ascending to Descending, there would be no problem - you can just do nothing and let the grid handle it. But the transition from Descending to Absolute Descending would require you to prevent the SortIndicator property on the column from changing and instead just attach the SortComparer. You would also have to handle the transition from Absolute Descending to Ascending and remove the SortComparer.


    None of this is trivial, especially if you are new to the grid, but it should all be possible, I think.

Children