i have tried build simple page includes openfaces datatable component.
i have tried enable pagination it. have done instruction its
developer's guide, when these 2 variables in bean, pagestart is
always zero!
this .xhtml file
<?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:o="http://openfaces.org/" xmlns:f="http://java.sun.com/jsf/core" xml:lang="en" lang="en"> <h:head> <title>my facelets page</title> <meta http-equiv="keywords" content="enter,your,keywords,here" /> <meta http-equiv="description" content="a short description of page." /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="styles.css" /> </h:head> <h:body> <div id="demo" class="content-inner-wrapper"> <f:view> <h:form id="form"> <o:datatable id="citiestable" value="#{testbean.lazymodel}" var="city" customdataproviding="true" pagesize="15" totalrowcount="#{testbean.count}" rowdatabykey="#{testbean.rowbykey}" rowkey="#{city.id}" styleclass="cities"> <o:singlerowselection/> <o:columnreordering/> <f:facet name="columnmenu"> <o:columnmenu/> </f:facet> <o:column id="name" header="city" sortingexpression="#{city.citytitle}" bodystyle="padding-left: 10px;"> <f:facet name="subheader"> <o:inputtextfilter expression="name"/> </f:facet> <h:outputtext value="#{city.citytitle}"/> </o:column> <o:column id="population" header="population" sortingexpression="#{city.citycode}" style="width: 20%;" bodystyle="text-align: right; padding-right: 15px;"> <f:facet name="subheader"> <o:comboboxfilter expression="population" options="#{citieslist.ranges}"/> </f:facet> <h:outputtext value="#{city.citycode}"> <f:convertnumber type="number"/> </h:outputtext> </o:column> <f:facet name="below"> <h:panelgroup> <o:datatablepaginator id="paginator" style="margin-left: 240px; margin-top: 10px;" /> <h:outputtext value="event log:" style="margin-top: 10px; margin-bottom: 5px; border-bottom: 1px solid black;"/> </h:panelgroup> </f:facet> </o:datatable> </h:form> </f:view> </div> </h:body> </html>
and bean:
package backbeans; import java.util.list; import javax.ejb.ejb; import order.tblbasecities; import order.tblbasecitiesfacadelocal; import org.openfaces.util.faces; public class testbean { @ejb tblbasecitiesfacadelocal cities; public list<tblbasecities> getlazymodel(){ int pagestart = faces.var("pagestart", integer.class); return cities.findall(pagestart,faces.var("pagesize",integer.class)); } public int getcount(){ return cities.findall().size(); } public tblbasecities getrowbykey() { integer key = faces.var("rowkey", integer.class); return cities.findbyid(key); } }
i using openfaces 3.0, myfaces 2.0.4 , weblogic 10.3.3 server
thanks in advance
it seems have forgot place datatablepaginator component itself. should place in "above" and/or "below" facet. make sure paginator's id specified explicitly function properly.
<o:datatable ...> <f:facet name="above"> <o:datatablepaginator id="paginator"/> </f:facet> ... </o:datatable>
Comments
Post a Comment