How to print total table row in SAPUI5 table

后端 未结 1 940
旧时难觅i
旧时难觅i 2021-01-29 02:39

I am trying this example in this I have to add total product count number i.e. total table rows display on screen.

https://sapui5.netweaver.ondemand.com/sdk/explored.htm

相关标签:
1条回答
  • 2021-01-29 03:08

    I answer your question by modifying the code of your example.

    1. Edit the 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>
    
    1. Edit the formatter.js, add one method totalFormatter.
    totalFormatter:function(results) {
        return results.length;
    }
    

    Then you will get the total table row.

    The basic idea is to utilize the Calculated Fields of Data binding to get the result length. The documentation can be found here.

    0 讨论(0)
提交回复
热议问题