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.
Syncfusion Feedback

GridGrouping Groups programmatically

Thread ID:

Created:

Updated:

Platform:

Replies:

47566 Aug 8,2006 01:42 PM UTC Aug 10,2006 07:04 AM UTC Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 8, 2006 01:42 PM UTC

Hi,

we are using a GGC. Assuming we are grouping with a column called "City". This column is removed from the VisibleColumns of the grid.

Now we have multiple entries with different city groups. Now when a user deletes all rows with a city called "San Diego" (e.g.) then the group disappears.

Now what I want is to stay the group even if the last row with "San Diego" was deleted. Because later on the user is able to add a new row for the "San Diego" group again.

Is this possible?

Any help would be great.

Cheers,
Franz

Administrator [Syncfusion]
Replied On August 8, 2006 02:38 PM UTC

Hi,

I thought of empty groups to solve that issue, but
I have just read in the forum that empty groups are not possible - that''s fatal for me.

I don''t wanna implement that with multiple tables in a dataset. The grouping feature with just one table seems fairly enough for my needs. So is there a workaround to solve my problem (with hidden rows or something like that)?

Need help please!

Cheers,
Franz

Administrator [Syncfusion]
Replied On August 9, 2006 06:29 AM UTC

Hi Franz,

Could you try this code to cancel the grid''s RecordDeleting event when the parentgroup having one record andthen set the record height to zero. Here is a code snippet.

private void gridGroupingControl1_RecordDeleting(object sender, Syncfusion.Grouping.RecordEventArgs e)
{
GridGroupingControl grid = sender as GridGroupingControl;
Group group = e.Record.ParentGroup;
if(group.GetRecordCount() == 1)
{
int RowIndex = grid.Table.DisplayElements.IndexOf(e.Record);
((IGridRowHeight)grid.TableControl.GetTableViewStyleInfo(RowIndex,0).TableCellIdentity.DisplayElement).RowHeight = 0;
e.Cancel = true;
grid.Refresh();
}
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/GGCAutoHeightAndResize_92b0b30e.zip

Please let me know if this helps.
Best Regards,
Haneef

Administrator [Syncfusion]
Replied On August 9, 2006 01:13 PM UTC

Hi Haneef,

this seems to be a good approach to solve the issue. Another one could be to use multiple tables (with the same columns and so on) in one dataset to simulate the grouping with one table. The only problem with that approach is the different width of the tables (the group cells) in the GGC. For example:

--------------------------------
| Table A |
---------------------------------------
| Table B |
---------------------------------------
| Table C |
-----------------------


But all tables have the same columns (but with different cell content length). Is it possible to
make all tables (table groups) the same length to
simulate a single table with grouping enabled? So
something like this would be great:

---------------------------------------
| Table A |
---------------------------------------
| Table B |
---------------------------------------
| Table C |
---------------------------------------

Any ideas?

Cheers,
Franz

Administrator [Syncfusion]
Replied On August 10, 2006 07:04 AM UTC

Hi Franz,

Try setting the AllowCalculateMaxColumnWidth property to false to resolve this.

//sets the maximum number of characters found in record field cells should be calculated for columns.
this.grid.TableDescriptor.AllowCalculateMaxColumnWidth = false;

//For particular table
this.grid.GetTableDescriptor("TableName").AllowCalculateMaxColumnWidth = false;

Let me know if this helps.
Thanks,
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.

Warning Icon 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.Close Icon

;