Custom Grouping Logic in Grid

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.


1 Reply

HA haneefm Syncfusion Team August 7, 2007 10:52 PM UTC

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

Loader.
Up arrow icon