Reputation: 14586
I have a SAPUI5 table with numbers. I want to add a sum/total row to summarize the values of each column. I checked the documentation of both table classes:
as well as column classes:
but can't figure out if there is a standard column property, which specifies the sum of column values. I found several topics on SO regarding this subject, e.g.:
But none of them is marked as answered.
Is there any default column property, which can provide a total value of the column's data?
Upvotes: 1
Views: 13314
Reputation: 438
sap.m.Column has an aggregation footer. You can place sap.m.Text with formatter there.
<Table items="{path: '/customers'}">
<columns>
<Column><Text text="Name" /></Column>
<Column>
<Text text="Amount" />
<footer><Text text="{path: '/customers', formatter: '.sumAmount'}" /></footer>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{name}" />
<Text text="{amount}" />
</cells>
</ColumnListItem>
</items>
</Table>
Upvotes: 4
Reputation: 1098
No, there is no property like this available with the controls you are looking at. As also mentioned in the posts you have referred, you will have to do this with javascript calculation and then you can use the footer to bind and show the sum (example for reference)
Nonetheless, this can be achieved simply with Fiori Analytical table sap.ui.table.AnalyticalTable
Let me know if this helps!
Upvotes: 1