How to add specific attributes to JSF datatable he

2019-07-19 23:17发布

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?

1条回答
神经病院院长
2楼-- · 2019-07-19 23:48

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>
查看更多
登录 后发表回答