Reputation: 41
I need to use sap.m.Table to display about 200 entries. I was aware I need to use the growing property. However when I add "growing: true, growingThreshold: 100", the table still shows 100 entries and the "more" button is not shown.
I've read some blog posts related to this problem. I tried setSizeLimit of my model but it didn't work. I'm using a JSONModel with the default countMode. Is there anything else I can try?
Thanks!
Upvotes: 1
Views: 2659
Reputation: 4231
Setting the size limit is not related to the growing feature, it just affects the maximum number of entries used in a list binding, e.g. you have stored 1000 entries and the size limit is 500 any list control bound to these entries will just show 500.
The JSONModel is more or less a dumb data store, it does not support the growing feature as it has no knowledge of your data and how to get the overall count. To achieve this you need to implement your own list binding which computes the count of your data for your specific case. You also need a custom model which uses this list binding.
JSONModel
sap.ui.define([
"sap/ui/model/json/JSONModel",
"xxx/ListBinding"
], function(JSONModel, ListBinding) {
"use strict";
return JSONModel.extend("xxx.JSONModel", {
bindList : function(path, context, sorters, filters, parameters) {
return new ListBinding(this, path, context, sorters, filters, parameters);
};
});
});
ListBinding
sap.ui.define([
"sap/ui/model/json/JSONListBinding"
], function(ListBinding) {
"use strict";
return ListBinding.extend("xxx.ListBinding", {
// in this case the array holding the data has a count property which stores the total number of entries
getLength : function() {
var path = !this.sPath ? "count" : this.sPath + "/count";
var count = this.oModel.getProperty(path, this.oContext);
return (count) ? count : ListBinding.prototype.getLength.call(this);
}
});
});
Upvotes: 4