【问题标题】:primefaces - passing property to dialogprimefaces - 将属性传递给对话框
【发布时间】:2013-06-15 00:08:51
【问题描述】:

我试图将一些数据从数据表传递到对话框,然后确认一些操作。我的问题是将属性传递给对话框不起作用,!出现没有数据的对话框!

代码:

<p:dataTable id="dt" var="cm" value="#{afficherUs.tdata}"  paginator="true"    rows="6"> 
           ....

         <p:column style="width:32px" >
             <p:commandLink   update="display" oncomplete="ChefDialog.show()" >
                 <img src="images/edit.jpg"></img>
       <f:setPropertyActionListener  value="#{cm}" target="#{afficherUs.selectedc}"  />
            </p:commandLink>
         </p:column>

    </p:dataTable>

和对话框:

<p:dialog header="Detail Compte " widgetVar="ChefDialog" resizable="false"
              width="350" showEffect="explode" hideEffect="explode">
        <p:messages></p:messages>
        <br></br>
        <h:panelGrid id="display" columns="2" cellpadding="2">

            <h:outputText value="Nom:" />
             <p:inplace editor="true" >
                 <p:inputText value="#{afficherUs.selectedc.nom}" required="true" label="text"></p:inputText>
            </p:inplace>


            <h:outputText value="Prenom:" />
             <p:inplace editor="true" >
                 <p:inputText value="#{afficherUs.selectedc.prenom}" required="true" label="text"></p:inputText>
            </p:inplace>
            <h:outputText value="Mot de passe:" />
            <p:inplace editor="true" >
                <p:inputText value="#{afficherUs.selectedc.psw}" required="true" label="text"></p:inputText>
            </p:inplace> 
            <h:outputText value="Role :" /> <p:inplace editor="true" >
                <p:inputText value="#{afficherUs.selectedc.role}" required="true" label="text"></p:inputText>
                                             </p:inplace>

            <h:outputText value=""></h:outputText> <p:panel style="border:none;"> <p:commandButton  value="Valider" action="#{afficherUs.editU}" update="dt msgs" ajax="true"></p:commandButton><p:commandButton  value="Annuler" oncomplete="ChefDialog.hide()"></p:commandButton></p:panel>

        </h:panelGrid>
    </p:dialog>

谢谢

【问题讨论】:

  • 你的 bean 的范围是什么?

标签: java primefaces dialog


【解决方案1】:

尝试将显示的完整 id 放在更新语句中,如下所示:

<p:commandLink update=":form:display" oncomplete="ChefDialog.show()" >
    ...
</p:commandLink>

Being :form: 由包含它们的form 的 id 构成。

重要提示:如果您的组件在表单之外的其他NamingContainer 中,您还必须连接它们的ID。这是一个例子Naming Container in JSF2/PrimeFaces

【讨论】:

  • 没什么变化,ChefDialog 显示表单但没有数据
  • 任何人都可以解释为什么数据不发送到对话框,这对我来说似乎很好,但我无法弄清楚问题出在哪里以及为什么不出现在对话框中是关于 primeface 版本还是请帮助
猜你喜欢
  • 1970-01-01
  • 2012-09-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-07
  • 2013-07-06
相关资源
最近更新 更多