我正在使用PrimeFaces dataTable。我需要列标题进行自动换行并且可以调整大小。以下是我的问题:
styleClass="wrap" resizableColumns="true"
时,只能调整大小
正在努力。styleClass="wrap" resizableColumns="false"
时,只有自动换行才有效。我的代码是:
<p:dataTable id="transitCycleHighLevelDataTable" var="record"
value="#{transitCycleMB.highLevel}" rowKey="#{record.group}"
paginator="true" paginatorPosition="bottom" rows="10"
styleClass="wrap" resizableColumns="true" scrollable="true"
scrollWidth="100%" scrollHeight="250"
rowsPerPageTemplate="10,20,50"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {RowsPerPageDropdown} {NextPageLink} {LastPageLink} {Exporters}"
currentPageReportTemplate="(Displaying {startRecord} - {endRecord} of {totalRecords}, Page: {currentPage}/{totalPages})">
答案 0 :(得分:0)
将此样式添加到dataTable
中将使列标题可以换行并且列的大小可调整:
.ui-datatable thead th {
white-space: normal !important;
}
注意:此功能已经过测试,可在PrimeFaces 6.2上运行。