加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何排除父组件的ajax更新中的子组件?

发布时间:2020-12-16 03:05:56 所属栏目:百科 来源:网络整理
导读:我正在使用PrimeFaces p:ajax我的代码中的标签我们如何排除子组件在更新父组件的ajax调用中得到更新? 如果您至少使用PrimeFaces 3.3,那么可以使用 PrimeFaces Selectors.这允许您使用 jQuery CSS selector syntax在PrimeFaces ajax组件的进程和更新属性.
我正在使用PrimeFaces< p:ajax>我的代码中的标签我们如何排除子组件在更新父组件的ajax调用中得到更新?
如果您至少使用PrimeFaces 3.3,那么可以使用 PrimeFaces Selectors.这允许您使用 jQuery CSS selector syntax在PrimeFaces ajax组件的进程和更新属性.

例如:

<h:form>
    <h:inputText ... />
    <h:inputText ... />
    <h:inputText ... styleClass="noupdate" />
    <h:inputText ... />
    <h:inputText ... />
    <p:commandButton ... update="@(form :not(.noupdate))"/>
</h:form>

该示例将更新整个表单,除了客户端中具有class =“noupdate”的输入.

如果要更新除特定组件之外的所有子项,请将“form”替换为周围组件的id(或类或…)

<h:form id="form">
    <h:panel id="myPanel">
        <h:inputText ... />
        <h:inputText ... />
        <h:inputText ... styleClass="noupdate" />
    </h:panel>
    <h:inputText ... />
    <h:inputText ... />
    <p:commandButton ... update="@(form :not(.noupdate))"/>
</h:form>

<p:commandButton ... update="@(#form:myPanel :not(.noupdate))"/>

只需确保使用完整的客户端ID.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读