【问题标题】:problem with editing a row in datatable using primefaces使用primefaces在数据表中编辑一行的问题
【发布时间】:2011-09-16 15:47:49
【问题描述】:

我在使用 primefaces 编辑数据表时遇到问题。 我已经测试了 datatableRowSelection 示例,但它不起作用。 当我单击按钮编辑时,将显示对话框但值为空。 请帮忙! 这是我的代码: 在:ListingPage.xhtml,我有:

                <p:column headerText="Edition">  
          <p:commandButton update="edition" oncomplete="marqueDialog.show()" image="ui-icon ui-icon-pencil">
              <f:setPropertyActionListener value="#{item}"  
                target="#{marqueController.selected}" />  
          </p:commandButton>

</p:column> 

width="400" height="500" showEffect="explode" hideEffect="explode" modal="true" >

    <h:panelGrid id="edition" columns="2" cellpadding="4">  

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

【问题讨论】:

    标签: jsf primefaces


    【解决方案1】:

    请参阅我对您之前不久发布的这个问题的回答...

    Cannot update a componet from p:commandLink 'update' attribute,the Link is persent in p:dataTable

    对话框的内部应该与数据表分开。

    编辑:为消除混淆,请勿这样做:

    <h:form ...>
      ...
      <h:form ...>
        ...
      </h:form>
      ...
    </h:form>
    

    另外,在对话框内放置一个表单,不要封装对话框:

    <h:form ...>
      ...
      <p:dataTable ...>
      ...
    </h:form>
    
    <p:dialog appendToBody="true" ...>
      <h:form ...>
        ...
      </h:form>
    </p:dialog>
    

    类似上面的内容应该允许命令按钮更新发生在对话框内的元素上。

    【讨论】:

    • 感谢您的回复,但它没有再次起作用。 被封装在
      被封装在 请你能解释更多我必须做什么?我很困惑
    猜你喜欢
    • 1970-01-01
    • 2013-10-22
    • 2013-09-24
    • 1970-01-01
    • 2016-04-17
    • 2012-03-23
    • 2012-09-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多