Hi to all!
Can someone help me out on this issue, that i have been searching and searching and nothing.I need to have somes rows like a sub-total of that group of rows.Like this:
| Col1 | Col2| Col3 | Qtd. | Money| A | X | X | 2 | 3€ | A | X | X | 3 | 7.10€| Sub-total | 5 | 10.10€ ( <- How to create this sub-total for lines A?) | B | X | X | 1 | 5€| B | X | X | 1 | 1€| Sub-total | 2 | 6€ ( <-How to create this sub-total for lines B?) | Total | 7 | 16.10€
I need all rows visible, sub-totals and grand-total.
Sample would be great...
MANY THANKS!!
Oops, actually it's not FixedOnTop/Bottom you need, it's GroupByRowsFooter.
Here's some sample code using the column names you show here.
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout layout = e.Layout; UltraGridBand band = layout.Bands[0]; // Add a Summary to the Qtd column UltraGridColumn qtdColumn = band.Columns["Qtd"]; band.Summaries.Add(SummaryType.Sum, qtdColumn); // Add a Summary to the Money column UltraGridColumn moneyColumn = band.Columns["Money"]; band.Summaries.Add(SummaryType.Sum, moneyColumn); // Set SummaryDisplayArea to show summaries at the bottom of each group and also // a grand total. band.Override.SummaryDisplayArea = SummaryDisplayAreas.GroupByRowsFooter | SummaryDisplayAreas.Bottom; // Allow OutlookGroupBy functionality. layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy; //layout.GroupByBox.Hidden = true; // Group by the "Col1" column. band.SortedColumns.Add("Col1", false, true); }
Hi Mike,
Is there a way to use Outlook GroupBy to get the group summaries and then display the grid w/o grouping. I know it sounds odd, but the requirement is not to explicitly show the groups but just show sum in the footer for each group and then a grand total in the last row. While i'm able to get the stuff using outlook groupby feature, just wondering whether there is a way to use it to get the sum and then show all rows w/o grouping.
Thanks !
There's no simple way to do that. You could, of course, just loop through the grid rows and perform the summary calculation yourself.
Hi
There isn't any image attached to your post.
But you can format the summary any way you like using the DisplayFormat property on the SummarySettings.
Ok.,I'll try Mike.
One another interesting thing that i noticed is about formatting the summary groupby column value. My case is, it is a decimal and if the rows have decimals, it displays summary as decimals, else it just ignores (which might be the correct way). But i'm looking for setting the format always to decimal so that it will read always as 00.00. I have attached a screenshot.
The first and last summaries in the screenshot are just integers though the column is formatted to decimal.
Any help is appreciated.
Hi,
Oddly enough, while the default summary footer caption text is different between the regular summaries and the grand totals, there is only a single property to set this.
So the only way to do this would be to use a CreationFilter.
Something like this:
private void Form1_Load(object sender, EventArgs e) { this.ultraGrid1.CreationFilter = new MyGrandTotalsSummaryFooterCreationFilter("Total SUM"); }
public class MyGrandTotalsSummaryFooterCreationFilter : IUIElementCreationFilter { private string summaryFooterCaption; public MyGrandTotalsSummaryFooterCreationFilter(string summaryFooterCaption) { this.summaryFooterCaption = summaryFooterCaption; } public void AfterCreateChildElements(UIElement parent) { SummaryFooterCaptionUIElement summaryFooterCaptionUIElement = parent as SummaryFooterCaptionUIElement; if (null == summaryFooterCaptionUIElement) return; ImageAndTextUIElementEx imageAndTextUIElementEx = summaryFooterCaptionUIElement.GetDescendant(typeof(ImageAndTextUIElementEx)) as ImageAndTextUIElementEx; if (null == imageAndTextUIElementEx) return; imageAndTextUIElementEx.Text = this.summaryFooterCaption; } public bool BeforeCreateChildElements(UIElement parent) { // Do nothing. return false; } }
One more requirement is to have the text displayed in the summary for each group and then a different text in the final summary row. For example: the Groupby row summary for each group should read "SUM" and then the the final summary footer should read "Total SUM".(which makes better readability for the users) I tried to set SummaryFooterCaption, but that seems to be common for the grouped rows as well as the final summary footer. Am i missing something ?