When I set the growing="true"
the smarttable shows wrong number of rows. How can I fix it?
In the documentations it says:
To avoid sending dedicated OData requests in order to improve your application's performance, you must configure the binding of the table as required.
It seems by configuring the binding of the smarttable this problem is solvable! but how I can play with this configuration? Can anyone provide me an example?
I finally found the answer regarding this issue.
I discovered what it shows as the row count is the number that the following function returns:
oTable.getBinding("items").getLength()
oTable
is the inner table inside the smart table.
But in reality what must be shown is the number of current context.
So if you bind the header of the smart table to a property in your view model you can update it each time the inner table is updated.
<smartTable:SmartTable id="__smartTableWorklist0" header="{woklistView>/table0}" showRowCount="false" tableType="ResponsiveTable" .....>
<Table id="table0" growing="true" growingThreshold="50" updateFinished="onTableUpdateFinished"> ... </Table>
And in the controller you have to update the header property like the following:
onTableUpdateFinished: function (oEvent) {
var oViewModel = this.getModel("woklistView");
var oTable = this.byId("table0");
oViewModel.setProperty("/table0", "Some Title (" + oTable.getBinding("items").getCurrentContexts().length + ")");
},