0
我試圖建立一個非常簡單的頁面,其中包括openfaces數據表組件。openfaces datatable問題
我試圖啓用它的分頁。我也做了指令就像它
開發者指南,但是當我在我的背上豆得到這兩個變量的pageStart是
始終是零!
這是我.xhtml文件
<?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 this 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>
,這是我回來豆:
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);
}
}
我使用openfaces 3.0,MyFaces的2.0.4和WebLogic 10.3.3服務器
在此先感謝
我不會忘記paginator,這些ara我的完整源代碼,但它還沒有工作。我編輯過這個帖子,請看看。 – arash 2011-05-02 10:04:05
我使用的配置幾乎相同,paginator對我來說工作正常!你是否嘗試過使用它而不使用? –
Hanynowsky
2011-06-25 16:28:19