我有一個p:treeTable和樹的內容都在一列中。該樹是一個共享組件,因此我的一些頁面需要列標題,有些則不需要。在columnHeader爲空的頁面中,它會爲列標題創建一個空行,這是我不想要的。我確實需要列內容,而不是沒有列標題時的標題。隱藏primefaces表列標題
我該如何解決這個問題?任何指針/想法都會很棒。謝謝!
我有一個p:treeTable和樹的內容都在一列中。該樹是一個共享組件,因此我的一些頁面需要列標題,有些則不需要。在columnHeader爲空的頁面中,它會爲列標題創建一個空行,這是我不想要的。我確實需要列內容,而不是沒有列標題時的標題。隱藏primefaces表列標題
我該如何解決這個問題?任何指針/想法都會很棒。謝謝!
可以解決了自定義CSS由THEAD顯示屬性設置爲none:
例子:
div[id="testForm:first"] thead {
display:none;
}
如果你的JSF與此類似:
<h:form id="testForm">
<p:dataTable id="first">
...
<p:/dataTable>
</h:form>
您可能發現你需要更具體的你的風格選擇:
div[id$="myTableId"]>div>table>thead { display:none; }
這也消除了引用你的表單ID的需要。 '$'是一個以通配符開始,'>'表示只選擇直接的孩子。請參閱http://www.w3schools.com/cssref/css_selectors.asp以獲得非常好的CSS選擇器參考。
更正式的解決方案:
TAG:
<p:treeTable styleClass="tree-table-no-header">
風格:
.tree-table-no-header thead {
display: none;
}
如果您<p:dataTable>
使用的列寬這樣
<p:dataTable styleClass="myTable">
<p:column width="100">
和你的U SE以下CSS隱藏的列標題
.myTable thead {
display:none;
}
你也將失去你設置
解決隱藏的列標題列寬,並保持列寬
.myTable thead th {
border: none !important;
background: none !important;
}
隱藏頭(與其他答案相同):
.hide-table-header thead {
display: none;
}
...並指定列寬:
<p:dataTable styleClass="hide-table-header">
<p:column style="width: 80px">
這些不會迴流= 「真正的」 表工作。
對於我來說邊框:無,背景:沒有建議在桌子上留下空的空間並隱藏桌子的左側邊框。
將此代碼添加到您的CSS3文件
** Remove the header from the dataTable**/
.ui-datatable.borderless thead {
display: none;
}
/** Remove the border from the dataTable **/
.ui-datatable.borderless tbody,
.ui-datatable.borderless tbody tr,
.ui-datatable.borderless tbody td {
border-style: none;
}
然後調用從XHTML文件中像這樣的代碼:
<p:dataTable styleClass="borderless">
謝謝回答,顯示:沒有爲我工作,調整了一點獲得預期的行.hide-column-header table thead tr [role ='row'] {display:none;} – santa029