Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
500
Add sub-total rows
posted

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!!

Parents
  • 469350
    Verified Answer
    Offline posted

    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);
            }

Reply Children