2

Can we show the total sum value of a particular column at the bottom of the same column in sapui5. Here i'm using sap ui table.

Thanks, Sathish

sathish
  • 90
  • 1
  • 4
  • 12
  • So far I only saw a sum value feature implemented in `sap.m.Table` as described here: http://scn.sap.com/thread/3610443 – Tim Gerlach Apr 07 '15 at 07:52

3 Answers3

3

If you are using sap.ui.table.Table

You can use different controls like(grid/layouts) to align as per requirement.

//Create an instance of the table control
var oTable = new sap.ui.table.Table({
    title: "Table Example",
    //other attributes
      footer: new sap.ui.commons.Label({
         text:"1234"
       })
});

If you are using sap.m libraries:(RECOMMENDED)

Adding footer property will do that. footer is one of the aggregation.

aggregation: footer

cardinality : 0..1

type: sap.ui.core.Control

description: Control to be displayed in the column footer.

Sample code: (use object number instead of Label to differentiate number and currency)

new sap.m.Column({
    //hAlign: "Right", use if required
    header: new sap.m.Label({
        text: "Amount"
    }),
    footer: new sap.m.ObjectNumber({
        number: "{Total}",
        unit: "{CurrencyCode}",
        state: "Warning"
    })
});
Sunil B N
  • 4,159
  • 1
  • 31
  • 52
2

I got a very nice solution with sap.ui.table.Table.

Actually adding a footer was not effective because it display the control under the whole table. So What I did is playing with the multiLabels aggregation.

And here I got the Sum displayed under the headline directly.

enter image description here

Gilles-Antoine Nys
  • 1,481
  • 16
  • 21
1

Recently I have come across similar issue, I have through lot of searches and came up with a solution for my scenario.

I have used Last Record as Total for all records and property fixedBottomRowCount="1".

Other Possible Solutions:

  1. Use Analaytical ALV, which has Total option
  2. Footer available at each column. I found this here, but have not verified the solution.
Tom Aranda
  • 5,919
  • 11
  • 35
  • 51