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.

Custom Grouping Logic in Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

67040 Aug 7,2007 06:42 PM Aug 7,2007 06:52 PM Windows Forms 1
loading
Tags: GridControl
Jogesh Menon
Asked On August 7, 2007 06:42 PM

Hi,

I wanted to know if we can use some custom logic when grouping in the Grid. For example right now when we drap the column header it groups on distinct values.

But what I am looking for is, say when a particular column is dragged , I use custom grouping logic (example: for numeric fields create bands like 1-10, 10-20, 30-40).

Is it possible for me to get handle to the grouping engine and data source of the grid?

Do you guys have any examples that could help me out.

Thanks,
Jogesh.


haneefm [Syncfusion]
Replied On August 7, 2007 06:52 PM

Hi Jogesh,

One way you can do this by adding your own custom Categorizer object to the SortColumnDescriptor. Once the column is grouped, the custom Categorizer is used to determine which adjacent records in the column belong to the same group. To create custom Categorizer objects, you define classes that implement ICategorizer (two methods). Please refer to the atttached sample and let me know if this helps.

private void GroupedColumns_Changed(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e)
{
if( e.Action == Syncfusion.Collections.ListPropertyChangedType.Insert)
{
SortColumnDescriptor column = e.Item as SortColumnDescriptor;
if( column.Name == "DateTime")
column.Categorizer = new CustomCategorizer();
}
}

Sample : CustomizedGrouping.zip

Also, check this knowledgebase article that shows you "How to create custom group in a GridGroupingControl?".
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=147


Best regards,
Haneef

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.

;