【问题标题】:Change column height based on the string inside PrimeFaces datatable根据 PrimeFaces 数据表中的字符串更改列高
【发布时间】:2014-01-27 08:44:53
【问题描述】:

我有一个数据表,其中一列,我想根据要显示的字符串更改列的高度。有时我得到的字符串很小,有时很长。所以在长字符串的情况下,我想改变列的高度,以便整个字符串可以包裹在列内。

下面是我的数据表的声明:

<p:dataTable var="employee" id="employees_table"
        value="#{employeeDetailsBean.selectedEmployee.details}">

        <p:column headerText="Employee Name">
            <h:outputText value="#{employee.name}" />
        </p:column>

        <p:column headerText="Employee Previous Work History">
            <h:outputText value="#{employee.prevWorkHistory}" />
        </p:column>
</p:dataTable>

【问题讨论】:

    标签: css jsf primefaces datatable


    【解决方案1】:

    您想要的是将文本包装在列中。 &lt;p:column width="50" headerText="Employee Name" styleClass="wrap"&gt; 添加 CSS .ui-datatable tbody td.wrap { white-space: normal; }

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-23
    • 1970-01-01
    • 1970-01-01
    • 2012-03-29
    • 2023-03-20
    • 2021-12-11
    • 2022-12-15
    • 2018-03-29
    相关资源
    最近更新 更多