We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Sorting of grouped columns

Thread ID:

Created:

Updated:

Platform:

Replies:

29221 May 19,2005 12:13 PM UTC Jun 2,2005 01:43 PM UTC WinForms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 19, 2005 12:13 PM UTC

Is it possible to sort the groups of a grouping grid by a different column than the one displayed for the groups? Specifically, I have a grouped column with the values Jan, Feb, Mar, ... and I want to sort the groups by date rather than alphabetically.

Administrator [Syncfusion]
Replied On May 19, 2005 11:43 PM UTC

One way you can do something like this is to use a custom comparer. Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GGC_SortGroup_e105e8e1.zip

Administrator [Syncfusion]
Replied On May 24, 2005 03:02 PM UTC

This works fine when setting the group order from code. However, if the user groups with another column and then regroups by the special column, the special order is lost. How can I handle this? I also have the same problem when using a custom comparer for a sorted column. If the user sorts by another column and then resorts by the special column, the custom comparer is not used anymore.

Administrator [Syncfusion]
Replied On May 24, 2005 05:15 PM UTC

You have to handle a couple of events to dynamically create the comparer immediately before the sorting or the grouping. Here is the sample modified to do this. http://www.syncfusion.com/Support/user/uploads/GGC_SortGroup_50d39b20.zip

Administrator [Syncfusion]
Replied On June 2, 2005 12:50 PM UTC

My compare operation is relatively expensive (requires a lookup in a separate table). With the custom comparer I guess this will be done on the order of n log(n) times. On the other hand, if I could simply change the sort column, I whould only need to initialize this new sort column once. This would require only n lookups and should thus be much cheaper than using the custom comparer. For the sorting it is easy to change the sort column, but I havn''t found a way to do this for the grouping. Is it possible in any way to change the sort column for the grouping? (I can of course create the new sort column and lookup that column from the custom comparer. Unfourtunately, the parameters provided to the comparer are the object values to compare rather than a reference to the records. Thus, I would still need a lookup in the table to find the records being compared, and this would be equally expensive.)

Administrator [Syncfusion]
Replied On June 2, 2005 01:43 PM UTC

>>Is it possible in any way to change the sort column for the grouping The only way I know would through a custom comparer. Instead of doing the time consuming work in the custom comparer, can you do the work once in say the constructor for the comparer save the results of this work in some efficient datastucture (hashtable or orderlist), and then just have teh Comparer method look up teh value instead of doing the work? I think this would be ''essentially'' adding another column and doing the sort on this other column.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;