如何为JSF datatable头添加特定的属性 [英] How to add specific attributes to JSF datatable header

查看:115
本文介绍了如何为JSF datatable头添加特定的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JSF 2.2,并希望在datatable标题行中添加一些特定的属性。 HTML的最终结果应该是这样的。

 < table> 
< th my-attribute =myattributevalue>标题列第<
....

这是否可能在JSF?

解决方案

使用 < f:passThroughAttribute /> 设置自定义属性。可以通过在< h:上设置 rowHeader =true来呈现 th 列/>

 < h:dataTable> 
< h:column rowHeader =true>
< h:outputText value =标题列/>
< f:passThroughAttribute name =my-attributevalue =myattributevalue/>
< / h:column>
< / h:dataTable>


I am using JSF 2.2 and want to add some specific attributes to the datatable header row. The end result in HTML should look something like this.

<table>
<th my-attribute="myattributevalue"> Header Column </th>
....

Is this possible in JSF?

解决方案

Use the <f:passThroughAttribute/> to set custom attributes. The th can be rendered by setting rowHeader="true" on an <h:column/>

    <h:dataTable>
          <h:column rowHeader="true">
               <h:outputText value="Header Column"/>
               <f:passThroughAttribute name="my-attribute" value="myattributevalue"/>
          </h:column>
    </h:dataTable>

这篇关于如何为JSF datatable头添加特定的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆