Hello,
I'am using UltraGrid (2009.2). I add 6 summeries in my ultragrid. The summeries #1-#5 are displayed as a sum of the columns 1-5 above them. The summary #6 are a sum of all columns. This summary #6 displaying in a new row.
But I want to have a "space" between the first summary row (#1-#5) and the second summary row (#6)..
Also I want to have that each summary row have on the left side a Caption ( i.e. Sum/Week, Total Sum)
COL1 COL2 COL3 COL4 COL5
111 222 333 444 555
Sum/Week : 222 444 666 888 1110
Sum/Total: 3330 (One row space to the row above this row)
I hope it is understandable what I want.
Thanks
BusinessClass said:But I want to have a "space" between the first summary row (#1-#5) and the second summary row (#6)..
There's nothing built-in to the grid to allow you to do this, but you might be able to acheive what you want by adding an additional summary to any one of the columns and then using a DrawFilter or a CreationFilter to hide that summary without actually setting it to hidden.
BusinessClass said:Also I want to have that each summary row have on the left side a Caption ( i.e. Sum/Week, Total Sum)
There's no support for a caption on the same line with the summaries. But if there is a column to the left of Col1, you could create a summary for that column that just displays some text. To get a summary that just shows text, you could set the DisplayFormat on the summary to a literal string.
I need to provide my own summery text for many columns.
How exactly can I achieve this?
Also, can the Summery Caption be removed??
Mike,
Sorry for the late reply!
Actually I dont need to calculate anything. The data comes back as part of a data set. Table1 fills the grid data and I want Table2 to fill the summaries on several of the columns
Okay, so if you already know the value of the summary, then the easiest thing to do is to create an ICustomSummaryCalculator class. All you have to do is return the value, or text, that you want to display in the summary.
When you add the summary to the grid you pass in an instance of your class which implements ICustomSummaryCalculator.
Here's some quick sample code I whipped up:
private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e) { UltraGridBand band = e.Layout.Bands[0]; UltraGridColumn column = band.Columns["Column 0"]; SummarySettings summarySettings = band.Summaries.Add( SummaryType.Custom, new LiteralCustomSummaryCalculator("This is my summary"), column, SummaryPosition.UseSummaryPositionColumn, column ); summarySettings.DisplayFormat = "{0}"; column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand); }
internal class LiteralCustomSummaryCalculator : ICustomSummaryCalculator { private string text; public LiteralCustomSummaryCalculator(string text) { this.text = text; } #region ICustomSummaryCalculator Members void ICustomSummaryCalculator.AggregateCustomSummary(SummarySettings summarySettings, UltraGridRow row) { } void ICustomSummaryCalculator.BeginCustomSummary(SummarySettings summarySettings, RowsCollection rows) { } object ICustomSummaryCalculator.EndCustomSummary(SummarySettings summarySettings, RowsCollection rows) { return text; } #endregion }
Great example I was able to adapt this rather easily.
Is it possible to apply Value based appearances to the summery row(s)?
Hi,
Elfmanne said:Is it possible to apply Value based appearances to the summery row(s)?
No, but you can use the SummaryValueChanged event on the grid to apply an appearance to the summary based on it's current Value in code.