使用 MyFaces 1.1 时如何获取表标题上的范围属性?
我正在使用带有 Facelets 和 Tomahawk 的 MyFaces 1.1.7。
创建常规数据表时,例如:
<h:dataTable value = "#{Datamanager.data}" var = "row">
<h:column>
<f:facet name = "header">
<t:div>
<h:outputText value = "Name" />
</t:div>
</f:facet>
<h:outputText value = "#{row}" />
</h:column>
</h:dataTable>
我得到一个 HTML 生成的表,其标题如下:
<table>
<thead>
<tr>
<th>
<div id="j_id4:j_id6">Name</div>
</th>
</tr>
</thead>
<tbody id="j_id4:tbody_element">
<tr><td>First</td></tr>
<tr><td>Second</td></tr>
</tbody>
</table>
但是,为了符合 WAI 验证,我希望在该标题上具有“范围”属性(即使范围只有 1 列) 。有谁知道如何添加它(通过让 MyFaces 默认添加它,或者通过添加额外的属性),以便我得到一个像这样的标题:
<thead>
<tr>
<th scope="col">
<div id="j_id4:j_id6">Name</div>
</th>
</tr>
</thead>
我尝试使用 like:
<f:facet name = "header">
<f:attribute name="scope" value="col" />
<h:outputText value = "Name" />
</f:facet>
但没有成功。
谢谢!
I'm using MyFaces 1.1.7 with Facelets and Tomahawk.
When creating a regular data table, like:
<h:dataTable value = "#{Datamanager.data}" var = "row">
<h:column>
<f:facet name = "header">
<t:div>
<h:outputText value = "Name" />
</t:div>
</f:facet>
<h:outputText value = "#{row}" />
</h:column>
</h:dataTable>
I get a HTML generated table with a header like:
<table>
<thead>
<tr>
<th>
<div id="j_id4:j_id6">Name</div>
</th>
</tr>
</thead>
<tbody id="j_id4:tbody_element">
<tr><td>First</td></tr>
<tr><td>Second</td></tr>
</tbody>
</table>
However, to conform with WAI validation I would love to have the "scope" attribute on that header (even when the scope is only 1 column). Does anyone know how to add it (either by having MyFaces add it by default, or by adding an extra attribute) so that I get a header like:
<thead>
<tr>
<th scope="col">
<div id="j_id4:j_id6">Name</div>
</th>
</tr>
</thead>
I have tried using like:
<f:facet name = "header">
<f:attribute name="scope" value="col" />
<h:outputText value = "Name" />
</f:facet>
with no success.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎已在 MyFaces 1.2 中修复
This seems to have been fixed in MyFaces 1.2