表动态加载SAPUI5/UI5 [英] Table dynamic loading SAPUI5 / UI5
问题描述
我想在SAPUI5-Table组件中显示大量数据.我曾经通过动态加载来实现这些数据表,这意味着该表最初加载了约50条记录.用户向下滚动足够远后,下一组50条记录被加载到表中.这样,我可以显示一个包含160.000多个条目的表,而不会出现任何性能问题.
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.
现在我需要对SAPUI5-Table做同样的事情.我已经实现了服务器端,可以使用OData服务.我已经实现了客户端,但是没有进行动态加载.该页面始终尝试将所有记录加载到数据库之外.
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.
我该如何实现?有什么预制的方法可以实现吗?我知道可以使用各种参数来调用OData服务,这些参数指定了将要传递的数据集,但是我不知道如何在滚动时将表制作为这些调用?
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?
推荐答案
Generally, a table bound to an OData Model does the most of it for you.
如果使用的是sap.m.Table
,则可以查看growing
属性
If you´re using sap.m.Table
you can take a look at the growing
properties here.
在List
部分中的sample.ListGrowing/preview"rel =" nofollow>浏览的应用.
An example on how to use paging with a sap.m.Table
can be found in the Explored app in the List
section.
使用sap.ui.table.Table
threshold
属性控制获取大小,并在
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.
sap.ui.table.Table
的一个非常简单的示例如下:
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>");
这篇关于表动态加载SAPUI5/UI5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!