2012-07-05 39 views
0

我試圖通過primefaces here使用primefaces對話框更新方法,我用我的bean替換了bean及其方法。Primefaces datalist ajax分頁對話框不更新

這是我做過什麼

<?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:f="http://java.sun.com/jsf/core" 
     xmlns:p="http://primefaces.org/ui" 
     xmlns:c="http://java.sun.com/jsp/jstl/core"> 
    <h:head> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     <link rel="stylesheet" type="text/css" href="../Styles/homepage-style.css" /> 
     <link rel="stylesheet" type="text/css" href="../Styles/profile.css" /> 
     <title>Shadi Bandhan | We find the best match for you</title> 
    </h:head> 

    <h:body> 

     <h:form id="form"> 

      <p:dataList value="#{messagesManagedBean.userInboxMsgs}" var="msg" id="cars" 
         paginator="true" rows="5" 
         paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}" 
         rowsPerPageTemplate="5,10,15" type="none"> 

       <f:facet name="header"> 
        Cars 
       </f:facet> 

       <p:commandButton icon="ui-icon-search" update=":form:carDetail" oncomplete="carDialog.show()" title="View Detail"> 
        <f:setPropertyActionListener value="#{msg}" target="#{messagesManagedBean.selectedMessage}" /> 
       </p:commandButton> 

       <h:outputText value="#{msg.message}, #{msg.userFullname}" style="margin-left:10px" /> 
       <br /> 
      </p:dataList> 

      <p:dialog header="Car Detail" widgetVar="carDialog" modal="true" showEffect="fade"> 
       <p:outputPanel id="carDetail" style="text-align:center;" layout="block"> 


        <h:panelGrid columns="2" cellpadding="5"> 
         <h:outputLabel for="modelNo" value="Message: " /> 
         <h:outputText id="modelNo" value="#{messagesManagedBean.selectedMessage.message}" /> 

         <h:outputLabel for="year" value="Full name: " /> 
         <h:outputText id="year" value="#{messagesManagedBean.selectedMessage.userFullname}" /> 

         <h:outputLabel for="color" value="User Id: " /> 
         <h:outputText id="color" value="#{messagesManagedBean.selectedMessage.userId}" style="color:#{tableBean.selectedCar.color}"/> 
        </h:panelGrid> 
       </p:outputPanel> 
      </p:dialog> 

     </h:form> 



    </h:body> 
</html> 

它打開的對話框中,但不顯示的值。 (對話框沒有更新) * 注意 *之前,當我使用ui時:重複而不是datalist,使用f:param方法很好。

感謝

回答

0

答案是

把commandlink或命令按鈕在<p:column></p:column>解決我的問題。

1
<h:form id="form"> 

      <p:dataList value="#{tableBean.cars}" var="car" id="cars" 
    paginator="true" rows="10" 
    paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}" 
    rowsPerPageTemplate="10,15" type="none"> 
       <p:column> 
     <f:facet name="header"> 
      Notificaciones 
     </f:facet> 
       <p:commandButton icon="ui-icon-search" update=":form:carDetail" oncomplete="carDialog.show()" title="View Detail"> 
      <f:setPropertyActionListener value="#{car}" target="#{tableBean.selectedCar}" /> 
       </p:commandButton> 

     <h:outputText value="#{car.manufacturer}, #{car.year}" style="margin-left:10px" /> 
     <br /> 
       </p:column> 
</p:dataList> 
+2

放到p:datalist並且工作!! –

+1

嘿,你能否詳細說明提問者實施過程中出現了什麼問題? –

+0

@ile你在說哪個提問者? –