2017-05-18 24 views
0

的號碼:數據表做工精細的獨立,但沒有這種情況的工作: (我使用Primefaces 6.1mojarra 2.2.9,P:dataTable的排序不會在用戶界面的工作:裝飾

index.xhtml代碼:

<h:body> 
    <ui:decorate template="/main.xhtml"> 
     <ui:define name="wrapper"> 
      <c:if test="#{not empty param['action']}"> 
       <ui:include src="/templates/param['action'].xhtml" /> 
      </c:if> 
     </ui:define> 
    </ui:decorate> 
</h:body> 

param['action']值是wrapper.xhtml代碼:

<body> 
    <ui:composition> 
      <h:form> 
       <p:dataTable var="menu" value="#{customerBean.listMenu}" 
        rowKey="#{menu.menuId}" selectionMode="single"> 
        <f:facet name="header"> 
         TEST 
        </f:facet> 
        <p:column headerText="Id" sortBy="#{menu.menuId}"> 
         <h:outputText value="#{menu.menuId}" /> 
        </p:column> 
        <p:column headerText="Action" sortBy="#{menu.name}"> 
         <h:outputText value="#{menu.name}" /> 
        </p:column> 
       </p:dataTable> 
      </h:form> 
    </ui:composition> 
</body> 

Java代碼:

@ManagedBean(name="customerBean") 
@RequestScoped 
public class CustomerBean { 
    @ManagedProperty("#{listMenu}") 
    private List<Test> listMenu; 

    @PostConstruct 
    public void init(){ 
     listMenu = new ArrayList<Test>(); 
     listMenu.add(new Test("123","Test","A1")); 
     listMenu.add(new Test("124","Test2","A12")); 
     listMenu.add(new Test("125","Test3","A13")); 
    } 

    public List<Test> getListMenu() { 
     if(listMenu == null){ 
      init(); 
     } 
     return listMenu; 
    } 

    public void setListMenu(List<Test> listMenu) { 
     this.listMenu = listMenu; 
    } 
} 

當我刪除<c:if test="#{not empty param['action']}">和硬編碼/templates/wrapper.xhtml,它工作正常。

有沒有缺失的步驟?

任何建議,將不勝感激,謝謝你的閱讀。

回答

0

我不知道爲什麼,但當我用p:panel替換<c:if test="#{not empty param['action']}">時,它工作正常!