javascript - 所有数组元素均未分配给模型

标签 javascript arrays express sapui5

我有来 self 的expressjs的数组,如下所示。我将此数组分配给我的前端框架 openui5 中的模型。但只有数组的前 100 个元素,即 [0-99] 被加载到模型中,并且不考虑所有其他数组元素,即 [100-520],为什么会这样以及如何确保所有数组元素都加载到模型中我的模型?

enter image description here

下面是用于加载模型的代码。

 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/

相关文章:

javascript - 在 html 标记中使用冒号并在 javascript 中处理其元素

javascript - 知道为什么当表单提交为空时不显示警报吗?

java - 本地化不适用于 Android 应用程序中的字符串数组

javascript - 切换/文档/单击并关闭其他?

javascript - console.log 中显示 undefined 的错误变量

arrays - 如何从名称列中的每个单元格中提取姓氏并将其分配给名称数组?

ios - 像刷新一样重新加载 tableview View

node.js - 如何使用 Express.js 包含用于服务器端计算的常规 JavaScript 脚本/库

node.js - Express默认使用集群吗?

javascript - Express JS子域静态内容