Primefaces Lazyload + datatable + lazyDataModel -
i did research, found many problems lazyload , datatable, none explains problem i'm having. posted problem on primefaces website , got no answers. either problem stupid or complex.
we updated our primefaces library 3.1.1 3.5, , our lazyload datatables stopped working. datamodel has changed, implemented new 1 based on primefaces showcase scenario.
the error is: java.lang.unsupportedoperationexception: lazy loading not implemented.
the thing is implemented class lazymethoddatamodel see code below. when debug, constructor called error throwed before load method called.
any thoughts? thank in advance. should need more information, please let me know.
public class lazymethoddatamodel_new extends lazydatamodel<produto> { @override public list<produto> load(int first, int pagesize, list multisortmeta, map filters) { generic.setrow(first); generic.setpage(pagesize); list objts = (list) reflection.getobjectbyinvokemethod(crud, method, generic); return objts; } public lazymethoddatamodel_new(crudfacade crud,string method,string methodcount,genericmodel<?> generic) { this.crud = crud; this.generic = generic; this.method = method; size = (integer) reflection.getobjectbyinvokemethod(crud, methodcount, generic); setrowcount(size); } @override public void setrowindex(int rowindex) { /* * following in ancestor (lazydatamodel): * this.rowindex = rowindex == -1 ? rowindex : (rowindex % pagesize); */ if (rowindex == -1 || getpagesize() == 0) { super.setrowindex(-1); } else super.setrowindex(rowindex % getpagesize()); }} front end
<p:datatable id="listproduto" var="model" value="#{adminprodutobean.lazydatamodel}" paginator="true" rows="10" paginatortemplate="{currentpagereport} {firstpagelink} {previouspagelink} {pagelinks} {nextpagelink} {lastpagelink} {rowsperpagedropdown}" rowsperpagetemplate="5,10,15" lazy="true">
there 2 load methods in lazydatamodel:
public list<t> load(int first, int pagesize, string sortfield, sortorder sortorder, map<string,string> filters) { throw new unsupportedoperationexception("lazy loading not implemented."); } public list<t> load(int first, int pagesize, list<sortmeta> multisortmeta, map<string,string> filters) { throw new unsupportedoperationexception("lazy loading not implemented."); } and need implement 1 more (also, remember enough implement first one).
Comments
Post a Comment