JSF rich:每行呈现的dataList?
看起来这应该是可能的,但是......?
使用 richfaces 和 JSF,我正在使用 rich:dataList 迭代列表...一切都很好,除了我希望能够有选择地“渲染”每次迭代,这可能吗?
例如:
<rich:dataList value="#{list}" var="item">
<h:outputText value="#{item.something}" />
</rich:dataList>
我希望能够有选择地渲染输出,例如,如果“item”的某些属性为 true 或其他任何属性。
我尝试将 outputText
包装在 outputPanel
中,但如果输出面板未呈现,则输出面板的 '
'迭代仍然被渲染,所以你得到一个项目符号点,旁边没有任何东西,而不是完全跳过该项目:(有什么办法解决这个问题,或者我是SOL吗?我意识到通常我想要准备好要显示的项目列表但由于很多原因,我不想在这里重复,这是不可能的。
Seems like this should be possible but ...?
Using richfaces and JSF I'm iterating over a List using rich:dataList ... all is fine except I'd like the ability to selectively 'render' each iteration, is that possible?
For example:
<rich:dataList value="#{list}" var="item">
<h:outputText value="#{item.something}" />
</rich:dataList>
I'd like to be able to render the output selectively, for example if some property of 'item' is true or whatever.
I've tried wrapping the outputText
in an outputPanel
and similar but if the output panel is not rendered the '<li>
' of the iteration is still rendered so you get a bullet point with nothing beside it rather than it just skipping the item entirely :(
Any way of solving this or am I SOL? I realize normally I'd want to get the List of items to display ready before hand but for many reasons I won't bother to repeat here it isn't possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
奇怪的行为。我尝试用 Tomahawk 的
t:dataList
我看到了完全相同的行为!您能做的最好的事情就是将其替换为a4j:repeat
并手动渲染纯 HTML
元素。类似的东西:(
我从
rich:dataList
借用了与 此处,这样可以保留皮肤)但是,我个人会将其标记为错误或至少作为不良行为,并将其报告给组件库背后的男孩有问题。 我已经为 Tomahawk 完成了。
Odd behaviour. I tried to reproduce it with Tomahawk's
t:dataList
and I am seeing exactly the same behaviour! Best what you can do is to replace it bya4j:repeat
and render plain HTML<li>
elements manually. Something like:(I've borrowed same classnames from
rich:dataList
as described here so that it keeps the skin)I personally would however mark it as a bug or at least as undesireable behaviour and report it to the boys behind the component library in question. I've already done it for Tomahawk.
简单的。将呈现的属性添加到 h:outputText 标记。
Simple. Add the rendered attribute to the h:outputText tag.