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. Image for the cookie policy date

Customized Grouping

Hi,

My table has a System.DateTime column. When grouped by this column, I would like it to group by date only (i.e. ignore the time). I found the 'How To' article showing a custom group and it works fine but I would like to override the default behaviour when the user drags the Date comumn to grouping area. The example creates a new custom group and dragging the Date column header to group area causes the same default behaviour. How do I custome the grouping behaviour for a column?

Thanks - Joel

1 Reply

AD Administrator Syncfusion Team February 26, 2007 07:20 PM UTC

Hi Joel,

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

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon