重新渲染复合组件的子组件
有没有办法指定复合组件的子组件使用 f:ajax 重新渲染:
<f:ajax render="compositeComponent:childComponent" />
从我的简短实验来看,似乎不可能引用它们,但我想知道是否有替代策略来完成此任务。
Is there a way to specify a child component of a composite component to re-render using f:ajax:
<f:ajax render="compositeComponent:childComponent" />
From my brief experimentation it doesn't seem possible to reference them but I wondered if there was an alternate strategy to accomplish this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它应该工作正常。它完全是客户端的(即,JSF 生成的 JavaScript 代码将其定位在 HTML DOM 树中)。
您可能引用了错误的客户端 ID。在网络浏览器中打开页面,右键单击并查看源代码,在页面源代码中找到生成的 HTML 元素并确定其 id 属性。您在
render
属性中指定的组件应绝对引用(前缀为:
)或相对引用(与父UINamingContainer
组件相比)到它。另一个可能的原因是您将
rendered
属性放在同一个复合组件的子组件上,该子组件的计算结果为false
,这反过来又导致生成的 HTML 元素在 HTML 中完全丢失。 DOM 树。然后,您希望将rendered
属性放在该组件的子组件上,如下所示:It should work fine. It's fully client side (i.e., the JSF-generated JavaScript code locates it in the HTML DOM tree).
Probably you referenced the wrong client ID. Open the page in the webbrowser, rightclick and View Source, locate the generated HTML element in the page source and determine its
id
attribute. The one which you specify in therender
attribute should refer either absolutely (prefix with:
) or relatively (as compared to the parentUINamingContainer
component) to it.Another possible cause is that you have put the
rendered
attribute on the very same composite component's child which evaluatedfalse
which in turn caused that the generated HTML element is totally missing in the HTML DOM tree. You would then like to put therendered
attribute on a child of that component instead, like so: