Friday, 6 September 2013

JSF2 lazy loading - how to get next page programmatically?

JSF2 lazy loading - how to get next page programmatically?

I've implemented DataTable - Lazy Loading sample. Similar to this one, but
I load data from database - it's not important though.
So I have:
public class LazyCarDataModel extends LazyDataModel<Car> {
...
}
and
public class TableBean {
private LazyDataModel<Car> lazyModel;
...
}
Somewhere, very deep in the procject I need to know what the current page
of this Car list looks like. So I do:
List<T> currentCarList =
(List<T>)getTestTableBean().getLazyModel().getWrappedData();
and I have. Last loaded cars (currently visiable in the browser). But, I
also need to see, what WILL BE next and previos page. I mean before user
clicks "Next page" there will be a warning massage "attention! there will
be Ferrari on the next page!" :D
So, finally my question: How to get next and previos page when using lazy
loading?

No comments:

Post a Comment