JSF:将 f:facet 标头设为 commandLink
jsf:
<rich:dataTable>
...
<h:column>
<f:facet name="header">
<h:commandLink action="fileSearchSort" styleClass="theader">
Name
</h:commandLink>
</f:facet>
#{f.name}
</h:column>
...
</rich:dataTable>
如果这样做:
...
<h:column>
<h:commandLink action="fileSearchSort" styleClass="theader">
<f:facet name="header">
Name
</f:facet>
</h:commandLink>
#{f.name}
</h:column>
...
标头中的标签“Name”就会消失。
是否可以将整个 f:facet
标头作为 commandLink
执行?
谢谢。
jsf:
<rich:dataTable>
...
<h:column>
<f:facet name="header">
<h:commandLink action="fileSearchSort" styleClass="theader">
Name
</h:commandLink>
</f:facet>
#{f.name}
</h:column>
...
</rich:dataTable>
if do this:
...
<h:column>
<h:commandLink action="fileSearchSort" styleClass="theader">
<f:facet name="header">
Name
</f:facet>
</h:commandLink>
#{f.name}
</h:column>
...
that label "Name" in header is dissappeared.
Is it possible to do whole f:facet
header as commandLink
?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
至于您所看到的行为,。将其放置在
将嵌套为 JSF 组件的直接子级,该组件应该拥有该facet,在本例中,因此 <代码>
内将使其成为
的构面,但该组件不支持构面名称为header
,因此您将看不到任何内容。至于具体的功能需求,JSF
组件呈现一个 HTML元素,默认情况下是 内联 元素。如果你想让它占据父级 HTML
元素的整个空间,那么你需要将
设为 block 元素代替。只需将
display: block
添加到其样式类中就可以了。As to the behaviour you're seeing, the
<f:facet>
is to be nested as direct child of the JSF component which is supposed to own the facet, which is in this case thus the<h:column>
. Placing it inside a<h:commandLink>
instead will make it to be the facet of the<h:commandLink>
, but that component doesn't support a facet with nameheader
, so you'll see nothing.As to the concrete functional requirement, the JSF
<h:commandLink>
component renders a HTML<a>
element which is by default an inline element. If you want to let it occupy the entire space of the parent HTML<th>
element, then you need to make the<a>
a block element instead. Just addingdisplay: block
to its style class should do.构面的元素将被渲染到某种容器中,因此如果您在
中放置或
< ;div>
标记占用整个区域,那么您的 commandLink 应该可以工作。The elements of the facet will be rendered into some kind of container, so if you place within the
<h:commandLink>
a<span>
or<div>
tag that consumes the entire area then your commandLink should work.