BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
We have analyzed your reported scenario. Our Syncfusion GridGroupingControl has support to customize grouping using IComparer and SortColumnDescriptor. Please refer the below provided code snippet and sample for further clarification. In this sample we have grouped the columns based a column value(similar to the image provided by you).
Code snippet:
//group "Col2" using a custom categorizer and Comparer
Syncfusion.Grouping.SortColumnDescriptor cd = new Syncfusion.Grouping.SortColumnDescriptor("Col2");
cd.Categorizer = new CustomCategorizer();
cd.Comparer = new CustomComparer();
this.gridGroupingControl1.TableDescriptor.GroupedColumns.Add(cd);
//defines a group and returns a group category object (here returns 1 through 5)
public static int GetCategory(string i)
{
int ret = 0;
if (i == "Group0")
{
ret = 1;
}
else if (i == "Group1")
{
ret = 2;
}
else
ret = 3;
return ret;
}
#region IGroupByColumnCategorizer Members
public object GetGroupByCategoryKey(SortColumnDescriptor column, bool isForeignKey, Record record)
{
return GetCategory(record.GetValue(column).ToString());
}
public int CompareCategoryKey(SortColumnDescriptor column, bool isForeignKey, object category, Record record)
{
return GetCategory(record.GetValue(column).ToString()) - (int)category;
}
Sample:
http://www.syncfusion.com/downloads/support/forum/119155/CustomGrouping-CS1667817960.zip
Please refer the below KB for reference. This is similar to you query. In this KB also column based custom grouping is done.
KB:
http://www.syncfusion.com/kb/498/how-to-do-custom-grouping-in-gridgroupingcontrol
Please let us know if you have any other concerns.
Thanks & Regards,
AL.Solai.
Hi Svyatoslav,
Thank you for your interest in Syncfusion products.We have analyzed your reported scenario. Our Syncfusion GridGroupingControl has support to customize grouping using IComparer and SortColumnDescriptor. Please refer the below provided code snippet and sample for further clarification. In this sample we have grouped the columns based a column value(similar to the image provided by you).
Code snippet://group "Col2" using a custom categorizer and Comparer
Syncfusion.Grouping.SortColumnDescriptor cd = new Syncfusion.Grouping.SortColumnDescriptor("Col2");
cd.Categorizer = new CustomCategorizer();
cd.Comparer = new CustomComparer();
this.gridGroupingControl1.TableDescriptor.GroupedColumns.Add(cd);
//defines a group and returns a group category object (here returns 1 through 5)
public static int GetCategory(string i)
{
int ret = 0;
if (i == "Group0")
{
ret = 1;
}
else if (i == "Group1")
{
ret = 2;
}
else
ret = 3;
return ret;
}
#region IGroupByColumnCategorizer Members
public object GetGroupByCategoryKey(SortColumnDescriptor column, bool isForeignKey, Record record)
{
return GetCategory(record.GetValue(column).ToString());
}
public int CompareCategoryKey(SortColumnDescriptor column, bool isForeignKey, object category, Record record)
{
return GetCategory(record.GetValue(column).ToString()) - (int)category;
}
Sample:
http://www.syncfusion.com/downloads/support/forum/119155/CustomGrouping-CS1667817960.zip
Please refer the below KB for reference. This is similar to you query. In this KB also column based custom grouping is done.
KB:
http://www.syncfusion.com/kb/498/how-to-do-custom-grouping-in-gridgroupingcontrol
Please let us know if you have any other concerns.
Thanks & Regards,
AL.Solai.