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.
Unfortunately, activation email could not send to your email. Please try again.

Grid Grouping (with a different sort??)

Thread ID:

Created:

Updated:

Platform:

Replies:

95655 Jul 22,2010 12:35 PM Jul 30,2010 04:43 AM Windows Forms 4
loading
Tags: GridControl
Jeff Voigt
Asked On July 22, 2010 12:35 PM

Hello,

I have a grid grouping control seen here:

http://screensnapr.com/u/uiepc4.png

I have the inner grouping set to the [TabName] column. However, our tabs have an internal sorting based on a number. Where "General" is 1 and "Background Investigations" is 2. I need to be able to group by the [TabName] but sort the order by the [TabSort] so that "General" comes before "Background Investigations".

Or, another solution would be to group by [TabSort] but convert the display to show [TabName]. I tried going this route but it is difficult as the QueryCellStyle method already had the [TabSort] CellValue set to a RichText formatted string (since it was converted to show Bold)...

How can I achieve this?

Jisha Joy [Syncfusion]
Replied On July 27, 2010 03:17 AM

Hi Jeff,

When a column is grouped, then that column will be added to the sorted column collection. This is a default behvior and we cannot avoid this. But you could make the "TabSort" column sorting when "TabName" column get grouped by handling GroupedColumns.Changing events.

Here is the code:


// in GroupedColumns_Changing event

if (e.Action == Syncfusion.Collections.ListPropertyChangedType.Add || e.Action == Syncfusion.Collections.ListPropertyChangedType.Insert)
{
SortColumnDescriptor scd = e.Item as SortColumnDescriptor;
scd.SortDirection = ListSortDirection.Descending;
if (scd != null && scd.Name == "TabName")
{
this.grid.TableDescriptor.SortedColumns.Add("TabSort");
}
}

Regards,
Jisha

Jeff Voigt
Replied On July 27, 2010 10:35 AM

Well that did not change the end result. The General tab is still showing up on the bottom.

Jeff Voigt
Replied On July 27, 2010 10:38 AM

To be more specific, you mentioned that when you group a column it is added to the SortedColumns collection. That is not happening. If it look at the state after I group the columns the GroupedColumns collection has values while the SortedColumns collection is still empty. If I manually try to add the TabID to the sorted columns it does nothing.

Jisha Joy [Syncfusion]
Replied On July 30, 2010 04:43 AM

Hi Jeff,

Thank you for your update. Could you please provide ua a sample showing the issue?. So that we could sort out the cause of the issue and provide youa solution based on it.

Regards,
Jisha

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.

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.

;