Not every item in the array has been allocated to the model

I am encountering an issue with loading all the elements of an array from my ExpressJS backend to my frontend framework OpenUI5. Despite having an array of 520 elements, only the first 100 elements are being loaded into the model. How can I ensure that all array elements are properly loaded into my model?

Here is the code snippet used to load the model:

 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); // Franchisees is an array of 520 elements
            that.getView().setModel(that.businessModel, 'businessModel');

        });
        $.when(businessQuery).fail(function (jqXHR, textStatus, errorThrown) {
            console.log(errorThrown);
        });    
    },

My view where the model is bound to a table is as follows:

 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);

Upon rendering the table, only the first 100 elements of the model are displayed instead of all 520 elements.

Regards, Chidan

Answer №1

If you want to extend the default size limit of 100, you can do so by using the setSizeLimit method:

oModel.setSizeLimit(999999);

Answer №2

In Chrome, when using the console.log() function, the array is displayed in groups of 100 items. However, by checking the length property, you can verify that the array actually contains a total of 520 items.

Answer №3

Finally, success! I was able to make it function by setting the properties growing: true and growingScrollToLoad: true on the Table component, which are actually inherited from ListBase.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to Retrieve Values from a Movie API?

Struggling with The Movie Database API integration. Specifically, I'm stuck on retrieving the "keys" variable when calling the function with the Movie's id. I'm still learning JavaScript, so this is proving to be a bit challenging. Any assis ...

Is it possible to include multiple API routes within a single file in NextJS's Pages directory?

Currently learning NextJS and delving into the API. Within the api folder, there is a default hello.js file containing an export default function that outputs a JSON response. If I decide to include another route, do I need to create a new file for it or ...

Creating a wrapper component to enhance an existing component in Vue - A step-by-step guide

Currently, I am utilizing quasar in one of my projects. The dialog component I am using is becoming redundant in multiple instances, so I am planning to create a dialog wrapper component named my-dialog. my-dialog.vue <template> <q-dialog v-bin ...

Conceal the element at all times

I'm facing a challenge with a paragraph element that is dynamically filled with content using Javascript. I need to hide the element whenever it doesn't have any text within it. However, I want to avoid using setTimeout or setInterval for this ta ...

Is it possible to launch a hidden tab or window and automatically submit the form within that tab/window?

I have a form for adding users to my Application. After submitting the form, I want to open a hidden TAB/WINDOW where another form is displayed with values retrieved from the database being written to a file. I need this second form to be automatically su ...

The powerful combination of ES6 and sequelize-cli

How can I execute sequelize migrations and seeds written in ES6? I attempted to use babel-node, but encountered a strange error. Command node_modules/babel-cli/lib/babel-node.js node_modules/sequelize-cli/bin/sequelize db:seed Error node_modules/b ...

Hide Details tag only on mobile view

How can I easily close the default opened <details> tag on mobile? I am working with Wordpress. Any suggestions on how to achieve this? <details open> <summary>Details</summary> Something small enough to go unnoticed. </ ...

Exploring the functionality of URLs in Node.js

I am working on testing an array of URLs to ensure that each one returns a 200 response code. So far, I have written the following code to accomplish this task. However, I have encountered an issue where only the last URL in the array is being tested. How ...

Is there a way to find the JavaScript Window ID for my current window in order to utilize it with the select_window() function in

I'm currently attempting to choose a recently opened window while utilizing Selenium, and the select_window() method necessitates its WindowID. Although I have explored using the window's title as recommended by other sources, and enabled Seleni ...

What is the best way to refresh an Angular model containing nested data?

This week, I started working on a proof of concept with Angular Material where I have a table displaying nested data: <table> <thead> <tr> <th colspan="2">Employee Name</th> <th>Ovr&l ...

Trouble encountered in PHP with looping over the start and end dates using strtotime function

I have an array structured like this: Array ( [0] => Array ( [start_date] => 2010-09-16 ) [1] => Array ( [end_date] => 2010-10-16 ) ... [9] => Array ...

Exploring ways to access global window variables in React using JavaScript

I've been following the discussion on how to transfer variables from JavaScript to ReactJS. Here is my array of objects in JavaScript: window.dataArr = []; function makeJsObj(descr, currDate, done) { var data = {}; console.log(descr ...

The Classic ASP error '800a0bcd' occurred while trying to access an ADODB.Field

Help, I encountered an error in the nsql part within the if pgset in the code block below. un = Ns(0) 'Issue Here' Any suggestions on how to troubleshoot this issue? I appreciate any assistance... sQuery = "select * from cash where mod ...

Steps to extract date selection from a datepicker using jQuery

I recently implemented this code snippet to utilize datepicker for displaying dates: $(document).ready(function(){ $("#txtFrom").datepicker({ numberOfMonths: 1, onSelect: function (selected) { var dt = new Date(selected); ...

Is it possible to utilize TypeScript code to dynamically update the JSON filter with variable values?

I am dealing with a JSON filter in which the value for firmwareversion needs to be replaced with a dynamic value. Here's how I've set it up: //JSON filter this.comX200FilterValue = '{ "deviceType": "ComX", "firmwareV ...

Is there a way to conditionally redirect to a specific page using NextAuth?

My website has 2 points of user login: one is through my app and the other is via a link on a third-party site. If a user comes from the third-party site, they should be redirected back to it. The only method I can come up with to distinguish if a user is ...

Using the onreadystatechange method is the preferred way to activate a XMLHttpRequest, as I am unable to trigger it using other methods

I have a table in my HTML that contains names, and I want to implement a feature where clicking on a name will trigger an 'Alert' popup with additional details about the person. To achieve this, I am planning to use XMLHttpRequest to send the nam ...

Implementing Routes in Express Using Typescript Classes

Seeking assistance in converting a Node.js project that utilizes Express.js. The objective is to achieve something similar to the setup in the App.ts file. In pure Javascript, the solution remains unchanged, except that instead of a class, it involves a mo ...

How should string arrays be properly utilized when using scanf_s?

char array1[10]; scanf_s("%9s", array1, (unsigned)_countof(array1); Can you please explain the meaning of (unsigned)_countof(array1)? Also, could you elaborate on the difference between using scanf_s("%9s", array1, sizeof(array1); ins ...

Sending a JavaScript function as part of an ajax response

I'm currently working on a system where the user can submit a form through AJAX and receive a callback in response. The process involves the server processing the form data and returning both an error message and a JavaScript function that can perform ...