2012-08-09 66 views
0

對於類似於下面的代碼,當光標懸停在列標題上時不會顯示標題。有任何想法嗎?當鼠標懸停在數據表的列上時標題不出現

 <h:column title="COLUMN 1"> 
      <f:facet name="header" >COL 1</f:facet> 
      <h:outputText id="col1" value="#{oneEntry.col1}" styleClass="al"/> 
     </h:column> 

     <h:column title="COLUMN 2"> 
      <f:facet name="header" >COL 2</f:facet> 
      <h:outputText id="col2" value="#{oneEntry.col2}" styleClass="al"/> 
     </h:column> 
+0

你可以請添加一些CSS,因爲這也可能導致故障 – Sato 2012-08-09 05:12:37

回答

0

<h:column>標籤沒有HTML 4.0傳遞屬性爲JSF生成這些都視若無睹,而<td>元素。在HTML中,表格由<td>組成,行和列內的元素在行內隱式定義。

所以它喜歡爲每一行的每個特定元素<td>指定標題屬性。

<table border="1"> 
    <tr> 
    <td title="first">Cell A1</td> 
    <td>Cell B1</td> 
    </tr> 
    <tr> 
    <td title="first">Cell A2</td> 
    <td>Cell B2</td> 
    </tr> 
</table> 

那麼有沒有像指定用於在HTML列一個總冠名,您可以爲<table>標籤,它不過是<h:dataTable>標題。

或者你也可以通過這樣的標題添加到您的組件列內對個人數據的單元格標題:

<h:column> 
     <f:facet name="header" >COL 1</f:facet> 
     <h:outputText id="col1" value="#{oneEntry.col1}" styleClass="al" title="COLUMN 1"/> 
</h:column> 

<h:column> 
     <f:facet name="header" >COL 2</f:facet> 
     <h:outputText id="col2" value="#{oneEntry.col2}" styleClass="al" title="COLUMN 2"/> 
</h:column> 

產生含有的outputText與title屬性的值<span>

+0

Ravi,非常感謝答案。根據這個答案,這是我的理解,一個列標題是不可能通過直線HTML。 我的回憶是,jquery.tablesorter支持像列標題的工具。也許這值得嘗試。 我嘗試使用primfaces工具提示,但無法弄清楚如何將它鏈接到列標題的id。 – user1186233 2012-08-09 05:43:31

+0

如果要在鼠標懸停上顯示工具提示或對話框,可以查看此答案。 http://stackoverflow.com/questions/11563004/mouseover-in-jsf-datatable/11568677 – Ravi 2012-08-09 05:55:13

相關問題