我在 dataTable 中遇到延迟加载问题,但不知道问题出在哪里,这是我的 xhtml 页面代码:
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Application</title>
</h:head>
<h:body>
<h:form>
<h:panelGrid columns="2">
<h:outputLabel value="Element per page"/>
<p:selectOneMenu value="#{applicationManagementListBean.pageSize}">
<f:selectItem itemLabel="5" itemValue="5"/>
<f:selectItem itemLabel="10" itemValue="10"/>
<f:selectItem itemLabel="30" itemValue="30"/>
<f:selectItem itemLabel="50" itemValue="50"/>
<p:ajax event="change" update="applicationDataList"/>
</p:selectOneMenu>
</h:panelGrid>
<p:commandButton value="New application"
action="inscription.xhtml?faces-redirect=true" ajax="false" />
<p:dataTable id="applicationDataList" value="#{applicationManagementListBean.applications}"
var="app" paginator="true"
rows="#{applicationManagementListBean.pageSize}" lazy="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
<p:column headerText="Code">
<h:outputText value="#{app.code}" />
</p:column>
<p:column headerText="Name">
<h:outputText value="#{app.name}" />
</p:column>
<p:column headerText="Abreviate name">
<h:outputText value="#{app.abrevName}" />
</p:column>
<p:column headerText="Status">
<h:outputText value="#{app.status.description}" />
</p:column>
</p:dataTable>
</h:form>
</h:body>
</f:view>
和豆代码:
@ManagedBean
@ViewScoped
public class ApplicationManagementListBean implements Serializable {
private static final long serialVersionUID = 1L;
@ManagedProperty(value = "#{applicationManagementService}")
public ApplicationManagementRemote applicationManagementService;
private Integer pageSize = 3;
private DataProxyLazyDataModel data;
public void setApplicationManagementService(
ApplicationManagementRemote applicationManagementService) {
this.applicationManagementService = applicationManagementService;
}
public LazyDataModel<Object> getApplications() {
data = new DataProxyLazyDataModel(applicationManagementService);
data.setPageSize(pageSize);
return data;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public DataProxyLazyDataModel getData() {
return data;
}
public void setData(DataProxyLazyDataModel data) {
this.data = data;
}
}
当我点击下一页按钮时没有任何反应
请帮忙,非常感谢,Rachid
primegaces 3.4.2,liferay 门户 6.1,日食