on 07-25-2019 9:21 AM
Hi,
I'm using sap.m.Table (with binding to JSON model) with growing enabled.
I would like to add a new button "Load All" which will load all the data (once), despite the standard growing behavior.
Is there any way to load all data at once when growing is set (even by temporarily disabling growing)?
Hi Shai,
very interesting question! I haven't implemented such fuctionality before, but did some experience today and it works.
In the View, you first define a Button:
<Button text="Fetch All" press="onFetchAll"/>
then, implement the Press Event in the controller:
onFetchAll: function(oEvent) {
var oTable = this.getView().byId("idTable"); //replace the id of your table
oTable.setGrowingThreshold(oTable.getMaxItemsCount()); //set threshold the max
oTable.getBinding("items").filter(); //refresh the table
},
The filter() / sort() method is used to refresh the table. Perhaps, there is a better way to do it.
I hope it could help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Haolin Zhi,
It works fine when need all the binding items from the table.
But it will not work, if the sap.m.Table has filter option. In that case, it always loads all the 'N' records from the model.
Scenario:
I have sap.m.Table with 500 records and filter is applied. Need to download the filtered data from the table.
onFetchAll: function(oEvent) {
var oTable = this.getView().byId("idTable"); //replace the id of your table
var nGrowingThreshold = oTable.getGrowingInfo().total; //total model threshold is 500
oTable.setGrowingThreshold(nGrowingThreshold); //set default threshold from 100 to 500
oTable.getBinding("items").filter(); //refresh the table
var aItems = oTable.getItems(); //always returns all 500 records
},
The above code refresh the table with all the model data and downloads all the 500 records instead of downloading only the filtered records. I am facing such an issue.
Please help me on this issue.
Regards,
Umesh
User | Count |
---|---|
65 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.