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

Column group summary for nested table

Thread ID:

Created:

Updated:

Platform:

Replies:

96165 Aug 25,2010 09:30 AM UTC Aug 26,2010 11:48 AM UTC Windows Forms 1
loading
Tags: Grouping
Christian Rattat
Asked On August 25, 2010 09:30 AM UTC

Hello,

I have a hierachy over 4 levels with a couple nested tables. In one nested table the rows are grouped by one column. For each group I need to have a summary row with a field for each column, i.e. the summary row should look the same as the records excepting that the font is bold. The ggc is filled using a dataviewmanager.

- How do I get a summary row added looking the same as the records?
- How do I fill the summary cells manually?
- When the content of the summary cells is set, I need to access the rows within the group of rows to which the summary row belongs to. How can I access these rows?

I attached a sample picture for a better understanding.

I had a look to the samples installed but I don't see how to do this.

Thanks in advance,
Christian



sample.png_b7368553.zip

Jisha Joy [Syncfusion]
Replied On August 26, 2010 11:48 AM UTC

Hi Christian,

Thank you for using Syncfusion products.

1. You could make use of the following code for providing the look for the SummaryFieldCell as RecordFieldCells.


this.gridGroupingControl1.Appearance.SummaryFieldCell.BackColor = this.gridGroupingControl1.Appearance.RecordFieldCell.BackColor;
this.gridGroupingControl1.Appearance.SummaryFieldCell.Borders.Top = new GridBorder(GridBorderStyle.Standard);


2. You could achieve the desired behavior by handling QueryCellStyleInfo event. See the code:


private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.TableCellType == GridTableCellType.SummaryFieldCell
&& e.TableCellIdentity.SummaryColumn != null)
{

if (e.TableCellIdentity.SummaryColumn.Name == "Sum1")
{
Group g = e.TableCellIdentity.DisplayElement.ParentGroup;

if (g.IsMainGroup)
{
e.Style.Text = null;//some value
}


}

}

}



3. You can get the summary value by using the static method GridEngine.GetSummaryText. And to get all the summary values you can loop through SummaryRowDescriptor.SummaryColumns collection of a summary row.

Here is a code snippet.

private void button1_Click(object sender, EventArgs e)
{
foreach (Element el in gridGroupingControl1.Table.DisplayElements)
{
GridRecordRow grr = el as GridRecordRow;
if (grr != null)
{
Console.WriteLine("Col1 = {0}", grr.GetRecord().GetValue("Col1"));
}
else
{
GridSummaryRow sr = el as GridSummaryRow;
if (sr != null)
{
foreach (GridSummaryColumnDescriptor scd in sr.SummaryRowDescriptor.SummaryColumns)
{
Console.WriteLine("{0} = {1}", scd.Name, GridEngine.GetSummaryText(sr.ParentGroup, scd));
}
}
}
}
}


Regards,
Jisha

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

;