This is using version 10.3 of the UltraGrid.
I have the following code creating a pair of summaries in a grid:
e.Layout.Bands[0].ColHeaderLines = 2;
e.Layout.Override.SummaryDisplayArea = SummaryDisplayAreas.TopFixed;
if (!e.Layout.Bands[0].Summaries.Exists("Protected"))
{
e.Layout.Bands[0].Summaries.Add("Protected", Infragistics.Win.UltraWinGrid.SummaryType.Sum, e.Layout.Bands[0].Columns[strProtectedColumn], Infragistics.Win.UltraWinGrid.SummaryPosition.UseSummaryPositionColumn);
e.Layout.Bands[0].Summaries["Protected"].DisplayFormat = "{0:######.00}";
e.Layout.Bands[0].Summaries["Protected"].Appearance.TextHAlign = HAlign.Right;
} // if (!e.Layout.Bands[i].Summaries.Exists("Protected"))
This works perfectly, putting the summary at the top of the column. However, In some cases, a row will have a child row and in this case the child row will also contain the summary from the parent row when expanded. I'd like to remove that summary from the child row.
I've tried specifically calling ResetSummaries in the child Band but it has no effect:
e.Layout.Bands[1].ResetSummaries();
Thanks in advance.
Dan
I have a similar issue with the summary tab from the parent band leaking into the child band. I checked at runtime and the child band has 0 summaries.
The following code adds the summary:
Private Sub MyUltraGrid_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles MyUltraGrid.InitializeLayout
Try
For Each col As UltraGridColumn In Me.MyUltraGrid.DisplayLayout.Bands(0).Columns
col.CellActivation = Activation.NoEdit
Next
Me.MyUltraGrid.DisplayLayout.AutoFitStyle = AutoFitStyle.ExtendLastColumn
With MyUltraGrid.DisplayLayout.Bands(0)
.ColHeaderLines = 2
.Override.HeaderPlacement = HeaderPlacement.FixedOnTop
.Columns("Name").Width = 180
.Columns("CountryCode").Header.Caption = "Country"
.Columns("CountryCode").Width = 55
.Columns("CurrencyCode").Header.Caption = "Curncy"
.Columns("CurrencyCode").Width = 55
.Columns("PriceCurrencyCode").Header.Caption = "Price Curncy"
.Columns("PriceCurrencyCode").Width = 70
.Columns("Shares").Header.Caption = "Shares"
.Columns("Shares").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
.Columns("Shares").Format = "#,##0"
.Columns("BasePrice").Header.Caption = "Base Price"
.Columns("BasePrice").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
.Columns("BasePrice").Format = "#,##0.00"
.Columns("BaseValue").Header.Caption = "Base Value"
.Columns("BaseValue").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
.Columns("BaseValue").Format = "#,##0.00"
.Columns("TotalCostPercentage").Header.Caption = "Total Cost %"
.Columns("TotalCostPercentage").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
.Columns("TotalCostPercentage").Format = "#,##0.0000%"
.Columns("TotalCostPercentage").CellAppearance.BackColor = PreferencesManager.GetSingleton.psHighlightColour
.Columns("TotalCostDollars").Header.Caption = "Total Cost $"
.Columns("TotalCostDollars").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
.Columns("TotalCostDollars").Format = "#,##0.00"
End With
If MyUltraGrid.DisplayLayout.Bands.Count > 1 Then
With MyUltraGrid.DisplayLayout.Bands(1)
.ColHeaderLines = 1
.Override.SummaryDisplayArea = SummaryDisplayAreas.None
.Override.AllowRowSummaries = AllowRowSummaries.False
.Columns("Order").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
.Columns("Size").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
.Columns("Cost").Header.Caption = "Cost bps"
.Columns("Cost").CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
.Columns("Cost").Width = 60
.Columns("BasePrice").Width = 70
.Columns("BucketCost").Header.Caption = "Bucket Cost $"
.Columns("BucketCost").Format = "#,##0.00"
End If
If Me.MyUltraGrid.DisplayLayout.Bands(0).ColHeaderLines > 1 Then
With e.Layout
.Override.SummaryFooterCaptionVisible = Infragistics.Win.DefaultableBoolean.False
With e.Layout.Bands(0)
Dim ss As SummarySettings
.Summaries.Clear()
ss = .Summaries.Add("Base Value", SummaryType.Sum, .Columns("BaseValue"), SummaryPosition.UseSummaryPositionColumn)
ss.Appearance.BackColor = PreferencesManager.GetSingleton.SUMMARY_ROW_COLOUR
ss.Appearance.TextHAlign = Infragistics.Win.HAlign.Right
ss.DisplayFormat = "{0:#,##0.00}"
ss = .Summaries.Add("Total Cost Dollars", SummaryType.Sum, .Columns("TotalCostDollars"), SummaryPosition.UseSummaryPositionColumn)
.Override.SummaryDisplayArea = SummaryDisplayAreas.Default
.Override.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCells
Catch ex As Exception
End Try
End Sub
Hi,
Are you certain that your code is not also adding a summary to the child band? I don't see any other reason why this would happen. Just as a test, you might want to check the child band to see if it has any Summaries on it at run-time.
if that doesn't help, then I cannot explain this. Can you duplicate this in a small sample project? If so, you can post it here (under the Options tab) and I'd be happy to take a look at it and see what's going on.
Looks like the part of the image with the actual summary in it got truncated, here is the right half of it.