如何从 p:dataTable 本身内部 ajax 更新 p:dataTable? [英] How to ajax-update the p:dataTable from inside the p:dataTable itself?

查看:20
本文介绍了如何从 p:dataTable 本身内部 ajax 更新 p:dataTable?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<h:form id="formId">
   <p:wizard id="wizardId">
      <p:tab id="tabId">
         <p:dataTable id="tableId">
           <p:column>
             <h:commandLink value="remove" update=""/>
           </p:column>
         </p:dataTable>
      </p:tab>
   </p:wizard>
</h:form>

我只需要更新 而无需更新整个表单.我尝试使用 @form@parent:formId:wizardId:tabId:tableId,但它们都没有按我的意愿工作.当我使用 @form 时,它正在检查我不需要做的验证.

I need to update only the <p:dataTable> without the entire form. I tried using @form, @parent, :formId:wizardId:tabId:tableId, but none of them are working as I want. When I use @form, it is checking for validation which I don't need to do.

我怎样才能做到这一点?

How can I achieve this?

推荐答案

首先,这确实不会与 一起工作,仅仅因为它不支持update 属性.也许你真的想使用 ?

First of all, this will indeed never work with a <h:commandLink>, simply because it doesn't support the update attribute at all. Perhaps you actually meant to use <p:commandLink>?

一旦您将 <h:commandLink> 修正为 <p:commandLink>,然后前往这个答案:如何找出ajax组件的客户端ID更新/渲染?找不到带有表达式foo"的组件引用自bar"以了解如何在 JSF ajax 中引用组件.

Once you've fixed the <h:commandLink> being a <p:commandLink>, then head to this answer: How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar" to learn how to reference components in JSF ajax.

阅读该答案后,您应该会发现数据表位于由 :formId:tableId 标识的这个特定代码片段中.所以,总而言之,应该做到以下几点:

After having read that answer, you should have found out that the datatable is in this particular code snippet identified by :formId:tableId. So, all with all, the following should do:

<p:commandLink value="remove" update=":formId:tableId" />

请注意,在 PrimeFaces 3.3 之前,在某些复杂的 UI 组合中 的 ajax 更新中存在一个错误.这在 PrimeFaces 3.4 中已修复.如果您恰好遇到这个问题并且无法升级到 PrimeFaces 3.4,那么您需要将表格包装在一些 <h:panelGroup id="tablePanelId"> 中,然后使用 update=":formId:tablePanelId" 代替.

Note that there's until with PrimeFaces 3.3 a bug in ajax-updating of the <p:dataTable> in certain complex UI compositions. This is fixed in PrimeFaces 3.4. If you encounter exactly this problem and can't upgrade to PrimeFaces 3.4, then you'd need to wrap the table in some <h:panelGroup id="tablePanelId"> and then use update=":formId:tablePanelId" instead.

这篇关于如何从 p:dataTable 本身内部 ajax 更新 p:dataTable?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆