I am using rich:dataTable
with 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
andrich:dataTableScroller
, and don't write my own components. Have somebody some ideas ?
views:
1501answers:
3
A:
You can write your own datamodel as child of richfaces ExtendedDataModel, which has method:
protected List<T> loadData(int offset, int limit, List<Order> orders)
MarrLiss
2009-08-13 07:20:05
there is no such method
Bozho
2009-12-01 14:15:44
He meant that "your own" datamodel should have this method. Similar as `ScrollableTableDataModel` has.
BalusC
2009-12-01 14:58:53
and if he just defines that method, and noone calls it, it would be useless. Furthermore, the last argument in `ScrollableTableDataModel` is the SortOrder, not a list
Bozho
2009-12-01 16:13:00
A:
You should create a custom org.richfaces.model.DataProvider
, and in getItemsByRange
you should fetch the limited data.
You should then construct an ExtendedTableDataModel
passing your custom DataProvider
, and use this model in your <rich:dataTable>
- value="#{myBean.myExtendedDataModel}"
Bozho
2009-12-01 14:17:45
A:
You can create your own "PagedDataModel", which actually returns only the data that will be shown in the page you are seeing.
I have found two complete examples for this:
Markos Fragkakis
2010-02-02 16:16:21