我有来 self 的expressjs的数组,如下所示。我将此数组分配给我的前端框架 openui5 中的模型。但只有数组的前 100 个元素,即 [0-99] 被加载到模型中,并且不考虑所有其他数组元素,即 [100-520],为什么会这样以及如何确保所有数组元素都加载到模型中我的模型?
下面是用于加载模型的代码。
onAfterRendering: function () {
var that = this;
var businessQuery= $.ajax({
type: "GET",
url: '/getAllBusinesses',
dataType: "json"
});
$.when(businessQuery).done(function (oBusinesses) {
that.businessModel= new sap.ui.model.json.JSONModel();
that.businessModel.setData(oBusinesses[0].franchisees); //fracnchisees is array of 520 elements
that.getView().setModel(that.businessModel, 'businessModel');
});
$.when(businessQuery).fail(function (jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
});
},
我的模型绑定(bind)到表的 View 如下所示,
var oBusinessListColumn = new sap.m.ColumnListItem({
cells: [
new sap.m.Button({
icon: '{businessModel>picture/data/url}',
text: '{businessModel>name}',
type: sap.m.ButtonType.Transparent,
press: [oController.showBusiness, oController]
}),
new sap.m.Button({
icon: 'img/Revember32_32.png',
text: {
path: 'businessModel>presentInRevember',
formatter: jQuery.proxy(oController.formatPresentInRevember, oController)
},
type: sap.m.ButtonType.Emphasized,
press: [oController.invitePressed, oController]
})
]
});
var oBusinessTable = new sap.m.Table('js-myBusiness-oBusinessTable', {
fixedLayout: false,
columns: [
new sap.m.Column({
header: new sap.m.Label({text: 'Business'})
}),
new sap.m.Column({
header: new sap.m.Label({text: 'Status'})
})
],
layoutData: new sap.ui.layout.GridData({span: "L12 M12 S12"})
}).addStyleClass('css-alignHorizontalCenter css-sTopBottomMargin card');
oBusinessTable.bindAggregation('items', 'businessModel>/', oBusinessListColumn);
渲染表格时,我只能看到模型的前 100 个元素,而不是完整的 520 个元素。
问候, 赤丹
最佳答案
您可以使用 setSizeLimit
将大小限制增加到默认值 100 以上。 :
oModel.setSizeLimit(999999);
关于javascript - 所有数组元素均未分配给模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28099576/