首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JSF更新复合组件

JSF更新复合组件
EN

Stack Overflow用户
提问于 2012-03-16 03:31:51
回答 1查看 7.3K关注 0票数 5

是否可以仅通过指定父复合ID来更新复合组件的子组件?例如,如果我有:

代码语言:javascript
复制
<composite:interface>
    <composite:attribute name="value" type="..." required="true"/>
</composite:interface>

<composite:implementation>
    <p:treeTable id="main-tree" ...>
        ...
    </p:treeTable>

</composite:implementation>

以某种方式使用它,比如:

代码语言:javascript
复制
<my:comp id="composite-component" />

...

<p:ajax update="composite-component" />

这有可能吗?现在,我看到的唯一方法是显式地指定子组件ID:

代码语言:javascript
复制
<p:ajax update="composite-component:main-tree" />
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-03-16 04:21:17

这可以通过在复合组件实现周围包装一个<div>并设置div的id=#{cc.clientId}来完成

代码语言:javascript
复制
<html ...>
    <composite:interface>
       ...
    </composite:interface>

    <composite:implementation>
      <div id="#{cc.clientId}">
        ...
      </div>
    </composite:implementation>    
</html>

在using页面中:

代码语言:javascript
复制
<my:comp id="composite-component" />
....
<h:commandButton value="Update first name">
   <f:ajax execute="composite-component" render="composite-component">
</h:commandButton>

<p:ajax>应该会相应地工作。

票数 15
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9726818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档