如何使p:dataTable列宽度根据数据自动调整?

时间:2015-02-12 23:48:14

标签: jsf primefaces

当我使用普通h:dataTable时:

<h:dataTable var="office"
        value="#{reportController.data}" width="100%"
        id="titleRpt" styleClass="data" border="1" cellpadding="2"
        columnClasses="none,rightAlign,rightAlign,rightAlign,rightAlign,rightAlign,rightAlign,rightAlign"
        headerClass="tableHeader"
        rowClasses="oddRow,evenRow"
        cellspacing="0" rendered="#{reportController.doDisplay and reportController.reportType eq 'T'}">

我得到以下输出:

enter image description here

但是,一旦我将h:dataTable更改为p:dataTable(除p之外的相同代码),我会得到以下内容:

enter image description here

如何让PrimeFaces根据内部数据(动态并从数据库中检索)自动设置列宽?我使用的是smoothness theme

我必须使用PrimeFaces版本而不是普通的JSF版本是因为我需要具有数据导出功能,而p:dataExporter要求它嵌套在ap:dataTable中,而不是h。< / p>

0 个答案:

没有答案