JSF更新复合组件 [英] JSF updating a composite component
本文介绍了JSF更新复合组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以仅通过指定父复合ID来更新复合组件的子组件?例如.如果我有
Is it possible to update child components of a composite component just by specifying the parent composite ID? E.g. if I have:
<composite:interface>
<composite:attribute name="value" type="..." required="true"/>
</composite:interface>
<composite:implementation>
<p:treeTable id="main-tree" ...>
...
</p:treeTable>
</composite:implementation>
并以这种方式使用它:
<my:comp id="composite-component" />
...
<p:ajax update="composite-component" />
有可能吗?现在,我看到的唯一方法是显式指定子组件ID:
Is that possible? Right now the only way I see is to specify the child component ID explicitly:
<p:ajax update="composite-component:main-tree" />
推荐答案
这可以通过在复合组件实现周围包装<div>
并设置div的id=#{cc.clientId}
:
This can be done by wrapping a <div>
around your composite components implementation and set the div's id=#{cc.clientId}
:
<html ...>
<composite:interface>
...
</composite:interface>
<composite:implementation>
<div id="#{cc.clientId}">
...
</div>
</composite:implementation>
</html>
在使用页面中:
<my:comp id="composite-component" />
....
<h:commandButton value="Update first name">
<f:ajax execute="composite-component" render="composite-component">
</h:commandButton>
<p:ajax>
应该可以正常工作.
这篇关于JSF更新复合组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文