AD
Administrator
Syncfusion Team
September 4, 2006 05:22 AM UTC
Hi James,
You can use the GetSummaryColumnAtCol method to get the GridSummaryColumnDescriptor in a grid. The GridSummaryColumnDescriptor.DisplayColumn property lets you specify under which column the summary should be displayed in the grid. GridSummaryColumnDescriptor elements that are added to the same row descriptor will be shown in the same row. Below is a code snippet
GridSummaryColumnDescriptor sd = e.TableCellIdentity.Table.TableDescriptor.SummaryRows["Row 1"].GetSummaryColumnAtCol(e.Style.TableCellIdentity.ColIndex);
Let me know if this helps.
Best Regards,
Haneef
JA
jamesb
September 4, 2006 08:06 AM UTC
This is still not working ro me. I do get a reference to the
GridSummaryColumnDescriptor col1 = new GridSummaryColumnDescriptor("sumCol1", SummaryType.Int32Aggregate, "[8/7/2006]", "{Sum:#}");
GridSummaryColumnDescriptor col2 = new GridSummaryColumnDescriptor("sumCol2", SummaryType.Int32Aggregate, "[8/14/2006]", "{Sum:#}");
GridSummaryColumnDescriptor col3 = new GridSummaryColumnDescriptor("sumCol3", SummaryType.Int32Aggregate, "[8/21/2006]", "{Sum:#}");
GridSummaryColumnDescriptor col4 = new GridSummaryColumnDescriptor("sumCol4", SummaryType.Int32Aggregate, "[8/28/2006]", "{Sum:#}");
GridSummaryRowDescriptor row = new GridSummaryRowDescriptor("Caption", "CaptionTitle", new GridSummaryColumnDescriptor[] { col1, col2, col3, col4 });
row.Visible = false;
this.gridGroupingControl.TableDescriptor.SummaryRows.Add(row);
In the QueryCellStyleInfo event, I have something like this...
if ( (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell || e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell))
{
Group group = e.TableCellIdentity.DisplayElement.ParentGroup;
GridTable table = e.TableCellIdentity.DisplayElement.ParentTable as GridTable;
GridSummaryRowDescriptor summaryRowDescriptor = table.TableDescriptor.SummaryRows["Caption"];
GridSummaryColumnDescriptor sumCol1 = summaryRowDescriptor.SummaryColumns[colIndex - 5];
if (sumCol1 != null)
{
SummaryDescriptor sd1 = sumCol1.SummaryDescriptor;
if (sd1 != null)
{
ISummary groupSummary = this.gridGroupingControl.Table.TopLevelGroup.GetSummary(colIndex - 5);
Int32AggregateSummary int32Summary = (Int32AggregateSummary)groupSummary;
int sum = int32Summary.Sum;
int max = int32Summary.Maximum;
int cnt = int32Summary.Count;
}
}
}
However, sum, max, and cnt arte always zero. What am I doing wrong?
JA
jamesb
September 4, 2006 08:52 AM UTC
I fix it... change date "[8/21/2006]" to "8/21/2006"