SAP UI 5 How to Print a Common Table Row

I am trying to use this example in this case, I have to add the total number of product numbers, i.e. the screen displays the summary rows of the table.

https://sapui5.netweaver.ondemand.com/sdk/explored.html#/sample/sap.m.sample.Table/preview

When I try to access ie's JSON object:

<headerToolbar>
    <Toolbar>
      <Label text="Products"></Label>
      <Label text=""{ path: '/ProductCollection', formatter: 'sap.m.sample.Table.Formatter.totalFormatter' }""> </Label>
    </Toolbar>
 </headerToolbar>
 totalFormatter:function(results) { return results.length; }

I get the SAP UI is not a rendering error:

→ Uncaught TypeError: Unable to read the 'length' property from undefined

-1
source share
1 answer

I will answer your question by changing the code of your example.

  • Change Table.view.xml, add one label in the Toolbar.

    <headerToolbar> <Toolbar> <Label text="Products"></Label> <Label text=""{ path: '/ProductCollection', formatter: 'sap.m.sample.Table.Formatter.totalFormatter' }""> </Label> </Toolbar> </headerToolbar>

  • Edit formatter.js, add one totalFormatter method.

    totalFormatter:function(results) { return results.length; }

Then you will get a general table of rows.

Calculated Fields of Data . .

0

All Articles