How to add specific attributes to JSF datatable header

Deadly 提交于 2020-01-04 13:26:32

问题


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:


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>


来源:https://stackoverflow.com/questions/27361546/how-to-add-specific-attributes-to-jsf-datatable-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!