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
close icon

GGC: Grouped Row

Hi,

What I want to accomplish is to have a grouped row to contain data which maps to the columns just as the child rows do.

Right now, I just populate the row with a string of data, but I would like to have a cell populated which corresponds to the correct column. Also, when I move the column, this should be reflected in the grouped row as well as the child rows.

A similar trick is done in your RealTimeUpdates example, where you populate a cell in the grouped row, however, this was done through a summary descriptor, which means I cannot populate that row from a stream of data.

Could you please come up with a solution for me to accomplish this task. Thanks you.

4 Replies

SA Saravanan A Syncfusion Team October 1, 2007 02:09 PM UTC

Hi Patrick,

If your intension is to display any record values in the group caption, then first you would have to disable the covered range over the group caption. You can achieve this by setting the ShowCaptionSummaryCells property to true.

ggc.TopLevelGroupOptions.ShowCaptionSummaryCells = true;
ggc.ChildGroupOptions.ShowCaptionSummaryCells = true;

Then you would have to handle the QueryCellStyleInfo event and provide the corresponding cell values to those cells in group caption. Please try this and let us know if it helps you.

Regards,
Saravanan


PC Patrick Cheng October 2, 2007 03:13 AM UTC

Hi Saravanan,

Could you please provide an example with code snippets of how to handle the QueryCellStyleInfo event to accomplish this?

Many thanks!

>Hi Patrick,

If your intension is to display any record values in the group caption, then first you would have to disable the covered range over the group caption. You can achieve this by setting the ShowCaptionSummaryCells property to true.

ggc.TopLevelGroupOptions.ShowCaptionSummaryCells = true;
ggc.ChildGroupOptions.ShowCaptionSummaryCells = true;

Then you would have to handle the QueryCellStyleInfo event and provide the corresponding cell values to those cells in group caption. Please try this and let us know if it helps you.

Regards,
Saravanan


PC Patrick Cheng October 4, 2007 02:46 AM UTC

Hi Saravanan,

Any update with the examples? Thanks in advance!

>Hi Saravanan,

Could you please provide an example with code snippets of how to handle the QueryCellStyleInfo event to accomplish this?

Many thanks!

>Hi Patrick,

If your intension is to display any record values in the group caption, then first you would have to disable the covered range over the group caption. You can achieve this by setting the ShowCaptionSummaryCells property to true.

ggc.TopLevelGroupOptions.ShowCaptionSummaryCells = true;
ggc.ChildGroupOptions.ShowCaptionSummaryCells = true;

Then you would have to handle the QueryCellStyleInfo event and provide the corresponding cell values to those cells in group caption. Please try this and let us know if it helps you.

Regards,
Saravanan


HA haneefm Syncfusion Team October 4, 2007 09:22 PM UTC

Hi Patrick,

Please refer to the attached sample for implementation and let me know if this helps.
CaptionTextSample.zip

Below are the codes that display first record values in a GridCaptionRow.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.GroupedColumn != null)
{
Element el = e.TableCellIdentity.DisplayElement;
if (el.ParentGroup.GroupTypedListRecords.Count > 0)
{
switch (e.TableCellIdentity.TableCellType)
{
case GridTableCellType.GroupCaptionCell:
Record rec = el.ParentGroup.GroupTypedListRecords[0];
e.Style.CellValue = rec.GetValue(e.TableCellIdentity.GroupedColumn.Name);
break;
case GridTableCellType.GroupCaptionSummaryCell:
Record rec1 = el.ParentGroup.GroupTypedListRecords[0];

if (e.TableCellIdentity.SummaryColumn != null)
e.Style.CellValue = rec1.GetValue(e.TableCellIdentity.SummaryColumn.Name);
else
{
GridTableDescriptor _td = el.ParentTableDescriptor as GridTableDescriptor;
int field = _td.ColIndexToField( e.TableCellIdentity.ColIndex );
if (field != -1 && field < _td.Columns.Count)
{
string _colName = _td.Columns[field].Name;
e.Style.CellValue = rec1.GetValue(_colName);
}
else
e.Style.CellValue = string.Empty;
}
break;
}
}
}
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon