Forum Stats

  • 3,826,356 Users
  • 2,260,634 Discussions
  • 7,896,915 Comments

Discussions

loadMoreOnScroll using RESTDataProvider

Chad Boom
Chad Boom Member Posts: 139 Blue Ribbon

We are having issues getting the loadMoreOnScroll functionality to work while using the RESTDataProvider. I was able to replicate this behavior by adding the loadMoreOneScroll property to the table and setting the height style in the example in the cookbook. If you add a bunch of entries to the arrayData.json file, you will notice the table does not load the additional rows - it only loads the default of 25 and does not load the additional rows as you scroll. Is there a trick to get this functionality working?


REST Data Provider | Overview | JET Developer Cookbook (oracle.com)

<oj-table

       id="table"

       aria-label="Departments Table"

       accessibility.row-header="depName" style="height:300px;"

       data="[[dataprovider]]" scroll-policy='loadMoreOnScroll'

       columns-default='{"sortable": "disabled"}'

       columns='[{"headerText": "Dept Id", "field": "DepartmentId", "id": "depId"},

            {"headerText": "Dept Name", "field": "DepartmentName", "id": "depName"},

            {"headerText": "Manager Id", "field": "ManagerId", "id": "manId"},

            {"headerText": "Date", "field": "Date", "id": "date"}]'

       class="demo-table-container"></oj-table>

User_I8F2R

Answers

  • The RESTDataProvider is meant to work with REST services that provide CRUD type functionality.

    The loadMoreOnScroll feature of the table or another other collection based component, will make a request to the RESTDataProvider with the proper offset and limit attributes and push that to the REST service for more data. If you are not using a REST service that supports pagination, this is not going to work.

    If you do not have a REST service that supports pagination, and you want to just make a REST call and pull all of the data down in one request, but load that data one page at time in the component, use something like the MutableArrayDataProvier or the ArrayDataProvider instead as that will work off of the local Array instead of trying to make REST calls.