1

我遇到了 primefaces datagrid 的问题。我正在尝试使用单击 p:commandLink 时选择的值来更新对话框。对话框最初不显示任何值,但是当我刷新页面并单击 commandLink 时,它会使用先前选择的值进行更新。我在 JBoss 4.3.0 上使用 primefaces-2.2.1。任何帮助将不胜感激。

  <p:column>
     <p:panel header="#{loc.loc_details}" style="text-align:center">
        <h:panelGrid columns="1" style="width:100%">
           <p:graphicImage value="/user/xyz/resources/images/#{loc.loc_details}.jpg"/> 

           <h:outputText value="#{loc.locality}" />
           <h:outputText value="#{loc.city}" />
           <h:outputText value="#{loc.state}" />
           <p:commandLink  update="locDetail,locDetailGrid" oncomplete="locDialog.show()" title="View Detail" border="0" >
               <p:graphicImage value="/user/xyz/resources/images/imagesCA6ETPOM.jpg" />
              <f:setPropertyActionListener value="#{loc}" 
                    target="#{tutorialsBean.selectedLocality}" />
           </p:commandLink>
        </h:panelGrid>
     </p:panel>
  </p:column>

<p:dialog header="Loc Detail" widgetVar="locDialog" modal="true">
  <p:outputPanel id="locDetail" style="text-align:center;" layout="block">



     <h:panelGrid id="locDetailGrid" columns="2" cellpadding="5">
        <h:outputLabel for="loc_details" value="Locality Details :" />
        <h:outputText id="loc_details" value="#{tutorialsBean.selectedLocality.loc_details}" />

        <h:outputLabel for="city" value="City: " />
        <h:outputText id="city" value="#{tutorialsBean.selectedLocality.city}" />

        <h:outputLabel for="state" value="State: " />
        <h:outputText id="state" value="#{tutorialsBean.selectedLocality.state}" />
        <h:outputText styleClass="text_normal" value="First Name" />
        <p:inputText id="fnameText" value="#{tutorialsBean.firstName}" />
        <h:outputText styleClass="text_normal" value="Last Name" />
        <p:inputText id="lnameText" value="#{tutorialsBean.lastName}" />
         <h:outputText styleClass="text_normal" value="Email" />
        <p:inputText id="emailText" value="#{tutorialsBean.email}" />
        <p:commandButton id="searchButton"  
           value="Submit" action="#{tutorialsBean.submitValues}"
           styleClass="button" />

     </h:panelGrid>
  </p:outputPanel>

4

1 回答 1

0

在您的 commandLink 中,在您的对话框中添加更新和处理属性以刷新信息。

像这样:

将 ID 放入对话框中:

 <p:dialog header="Loc Detail" id="locDialog" widgetVar="locDialog" modal="true">

将更新放入对话框:

<p:commandLink update="locDetail,locDetailGrid" oncomplete="locDialog.show()" title="View Detail" border="0" update="locDialog" process="@this" ajax="true" partialSubmit="true" >
   <p:graphicImage value="/user/xyz/resources/images/imagesCA6ETPOM.jpg" />
      <f:setPropertyActionListener value="#{loc}" target="#{tutorialsBean.selectedLocality}" />
</p:commandLink>
于 2013-12-27T16:49:50.570 回答