Skip to content
Advertisement

How to display the summarized value of multiple rows numbers in a Text [SAPUI5]

as the title states, let’s say i do have the following model:

JavaScript

Question 1: How can i display count as summarized number i.e. 7 in a Text?

JavaScript

Question 2: Is there a technicality, which could allow such summarization ?

What i tried: Formatter function.

JavaScript

Issue: Formatter, function sumCount, does get the value of each row, i.e. 3, 4 etc…, which means it doesn’t have an overarching capability to loop through the whole model and add all the counters and return the summarized value to the <Text>

Advertisement

Answer

Question 2: Is there a technicality, which could allow such summarization ?

You can achieve that via an formatter.

Suppose you have defined the following sap.ui.model.json.JSONModel in the controller:

JavaScript

and you have the following formatter.js file:

JavaScript

this will work:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement