我有来自我的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);
});
},
我的视图模型绑定到表的位置如下所示
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个元素。
此致 赤丹
答案 0 :(得分:1)
您可以使用setSizeLimit
oModel.setSizeLimit(999999);
答案 1 :(得分:0)
Chrome的console.log()
显示按100个项目分组的数组。在length
属性中,您可以看到该数组包含所有520个项目。
答案 2 :(得分:0)