There is requirement to change behaviour of sap.ui.table depending on no. of rows present in backend being binded to table and a threshold value set. So if no. of rows are less than threshold value, then load all rows data and sorting/filtering done in browser i.e operationMode Client.
But if large no. of rows present exceeding threshold value then load with $top/$skip and sorting/filtering should trigger backend call i.e. operationMode Server.
As per documentation operationMode Auto should have worked but it keeps the sorting/filtering always on Server side irrespective of few rows present which are less than threshold value and so not working purely as Client operationMode.
Is there a direct way in XML view binding to change operationMode to Client/Server depending on count condition or operationMode injected conditionally in
<Table id="myTable" threshold="200" visibleRowCount="10" minAutoRowCount="10"
rowHeight="40"
visibleRowCountMode="Interactive"
rowSelectionChange="onTableChange"
rows="{path: 'SampleEntitySet', parameters: {expand: 'Test123', operationMode : 'Server'}, events: {change: '.onTableChange'}}">
Please help in suggestion to solution. Thanks
The question points to OperationMode.Auto (https://ui5.sap.com/1.102.1/#/api/sap.ui.model.odata.OperationMode) which had been pointed out in a comment already. However, that OperationMode is not fully functional (likely since a long time) and is deprecated as of SAPUI5 1.102.
It makes sense to understand why you want to have such a differentiation in behavior. OperationMode.Client can be used as an optimization in case the data volume is small. This will mostly optimize the load caused on the backend. The user may not be aware of the difference unless the network to the backend is bad. And even the load for sorting or filtering on the server is not a real issue if the data volume is small.
So the question is whether there is actually another issue hidden behind the question and it makes sense to work on that issue.
The "threshold" should be defined as a binding parameter, not as a property for the table. e.g.
oTable.bindRows({
path : "/Categories",
parameters: {
operationMode : "Auto",
countMode : "Inline",
threshold: 9
}
})
Please see the jsbin below and set the threshold property less than 8 to see the batch request for the sorting of the CategoryName column (Server mode) or set it bigger than 8 to see the Client mode in action. https://jsbin.com/wutiyudoru/1/edit?html,output