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.

users group of subgroup number

Thread ID:

Created:

Updated:

Platform:

Replies:

119155 May 15,2015 02:30 AM May 19,2015 09:42 PM Windows Forms 3
loading
Tags: GridGroupingControl
Svyatoslav Razmyslov
Asked On May 15, 2015 02:30 AM

Hello. I use the default group and get many groups with small number of items. How to unite groups, for example, groups with 1-2 items to one? I want to combine the group with only 1 item to another group. Example is attach.

Attachment: screen_example_13c68430.zip

Solai A L [Syncfusion]
Replied On May 15, 2015 09:16 AM

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.


Svyatoslav Razmyslov
Replied On May 18, 2015 11:05 AM

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.


GetCategory() method is a grouping of the contest, but my data can be of different types and must be sorted in a standard way. The essence of my question: how to unite groups with one element of the same group?

For example:
---------------------------------------------------------------------------
17 lines - with default group we will see the following groups (7):

Group: cplus-dem.c (Count=1)                   <== bad group
Group: floatformat.c (Count=2)
Group: libbfd.c (Count=2)
Group: merge.c (Count=1)                          <== bad group
Group: regex.c (Count=7)
Group: simple-object-coff.c (Count=1)       <== bad group
Group: sort.c (Count=3)


must obtain (5)


Group: floatformat.c (Count=2)
Group: libbfd.c (Count=2)
Group: regex.c (Count=7)
Group: sort.c (Count=3)
Group: other files (Count=3)   <== (for cplus-dem.c, merge.c and simple-object-coff.c)
--------------------------------------------------------------------------------------------------
How can I do that?

Solai A L [Syncfusion]
Replied On May 19, 2015 09:42 PM

Hi Svyatoslav,

Thank you for your update.

We have prepared a sample as per your requirement. For thisGrouping based on IComparer is not required. We can achieve this by performing a grouping based on adjacent column value in QueryValue event. Please refer the below provided sample and let us know if you have any other concerns.

Sample:
http://www.syncfusion.com/downloads/support/forum/119155/WindowsFormsApplication21_(4)-1651798363.zip

Please let us know if you have any other concerns.

Thanks & Regards,
Al.Solai

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.

;