[英]Lazy data loading with rich:dataTable and rich:dataTableScroller
I am using rich:dataTable
with rich:dataTableScroller
. 我正在使用
rich:dataTable
和rich:dataTableScroller
。 And I don't want load all my data from DB when initialize table, because I have very many records. 而且我不希望在初始化表时从数据库加载所有数据,因为我有很多记录。 I want that that
rich:dataTableScroller
show me real page count but load page only when I switch on in. I find some solution here But I want use rich:dataTable
and rich:dataTableScroller
, and don't write my own components. 我想让
rich:dataTableScroller
向我显示真实的页面计数,但仅在打开电源时才加载页面。我在这里找到了一些解决方案,但是我想使用rich:dataTable
和rich:dataTableScroller
,不要编写自己的组件。 Have somebody some ideas ? 有一些想法吗?
You should create a custom org.richfaces.model.DataProvider
, and in getItemsByRange
you should fetch the limited data. 您应该创建一个自定义
org.richfaces.model.DataProvider
,并在getItemsByRange
获取有限的数据。 You should then construct an ExtendedTableDataModel
passing your custom DataProvider
, and use this model in your <rich:dataTable>
- value="#{myBean.myExtendedDataModel}"
然后,您应该构造一个传递自定义
DataProvider
的ExtendedTableDataModel
,并在您的<rich:dataTable>
value="#{myBean.myExtendedDataModel}"
使用此模型
您可以将自己的数据模型编写为richfaces ExtendedDataModel的子模型,该子模型具有以下方法:
protected List<T> loadData(int offset, int limit, List<Order> orders)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.