I'm trying to use a Datascroller with a LazyDataModel and the load method from lazy data model is getting called twice.
Appart from thinking that it is not so good to call the load method multiple times (that may perform costly server/DB roundtrips), since my lazy data model not idempotent (meaning, two consecutive calls to the model on the same window/page size returns different outcomes) the fact that it's being called twice means: the presented results are not correct.
Is it normal for the load method in datascroller to be called twice? If so, any workarounds suggested for my alternative to work correctly? (appart from changing from statefull to stateless data model)
Using Primefaces 5.1, JSF2, Glassfish 4.1
Since the header facet, in BalusC post, is not correctly rendered if the first load (commented section) does not run, a slightly different implementation is needed
Not sure if this is the best implementation, but it worked.
EDIT: an issue has been filed in PrimeFaces GitHub
No, this is not normal. This is indeed a bug in PrimeFaces. We also discovered it a while ago when using it at zeef.com. We bypassed it by creating a custom renderer extending
DataScrollerRenderer
and overriding onlyencodeMarkup()
method with the original implementation copypasted and then only the following piece outcommented:You can get it to run by registering it as below in webapp's
faces-config.xml
: