Table dynamic loading SAPUI5 / UI5

眉间皱痕 提交于 2020-01-15 03:56:28

问题


I want to display a huge set of data in a SAPUI5-Table component. I used to implement these datatables with dynamically loading, which means that the table initially loaded ~50 records. After the user scrolled down far enough, the next set of 50 records were loaded into the table. This way it was possible for me to display a table of more than 160.000 entries without any performance issues.

Now I need to do the same with SAPUI5-Table. I already implemented the server side, the OData service is ready to use. I already implemented the clientside but without that dynamic loading. The page always tries to load all records out of the database.

How can i achieve this? Is there any premade way to implement this? I know that the OData service can be called with various parameters which specify the dataset it will deliver, but i dont know how to make the table to these calls while scrolling?


回答1:


Generally, a table bound to an OData Model does the most of it for you.

If you´re using sap.m.Table you can take a look at the growing properties here.

An example on how to use paging with a sap.m.Table can be found in the Explored app in the List section.

Using sap.ui.table.Table the threshold property controls the fetch size and is described here. Additionally you can choose a navigationMode. It can be a Paginator as well as a Scrollbar.

A very simple example for sap.ui.table.Table looks like this:

var oModel = new sap.ui.model.odata.ODataModel("<yourURL>", true);
var oTable = new sap.ui.table.Table({
          columns : [], //set up columns as usual
          threshold : 50 //your fetch size here
});
oTable.setModel(oModel).bindRows("/<yourEntity>");


来源:https://stackoverflow.com/questions/26532238/table-dynamic-loading-sapui5-ui5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!