Sapui5 正在增长的表不使用JSONModel
我需要使用sap.m.Table来显示大约200个条目。我意识到我需要使用不断增长的财产。但是,当我添加“growing:true,growingThreshold:100”时,表中仍然显示100个条目,而“more”按钮没有显示 我读过一些关于这个问题的博客文章。我试着对我的模型进行设置,但没有成功。我使用的是带有默认countMode的JSONModel。还有什么我可以试试的吗Sapui5 正在增长的表不使用JSONModel,sapui5,Sapui5,我需要使用sap.m.Table来显示大约200个条目。我意识到我需要使用不断增长的财产。但是,当我添加“growing:true,growingThreshold:100”时,表中仍然显示100个条目,而“more”按钮没有显示 我读过一些关于这个问题的博客文章。我试着对我的模型进行设置,但没有成功。我使用的是带有默认countMode的JSONModel。还有什么我可以试试的吗 谢谢 设置大小限制与不断增长的功能无关,它只会影响列表绑定中使用的最大条目数,例如,您已存储1000个条目,而大小
谢谢 设置大小限制与不断增长的功能无关,它只会影响列表绑定中使用的最大条目数,例如,您已存储1000个条目,而大小限制为500。绑定到这些条目的任何列表控件将仅显示500 JSONModel或多或少是一个愚蠢的数据存储,它不支持不断增长的特性,因为它不知道您的数据以及如何获得总计数。要实现这一点,您需要实现自己的列表绑定,该绑定计算特定案例的数据计数。您还需要使用此列表绑定的自定义模型 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);
};
});
});
列表绑定
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);
}
});
});
谢谢你的意见!但是,我通过以下操作解决了问题:我更改了我的oTable.bindAggregation(“,“dfcr>/”,oTemplate);到oTable.bindAggregation(“items”,“dfcr>/”,oTemplate);请提供一个运行示例。在哪里定义了
BaseBinding
?它应该是JSONListBinding。类名似乎随着时间的推移而改变,因此您需要在openui5/src/sap.ui.core/src/sap/ui/model/json/JSONModel.js中检查