How to show 2 line in one column in datatable?

alignment, datatable, jsf, jsf-2, primefaces

Solution

The `.ui-datatable tbody td` has a default style of `white-space: nowrap`, meaning that long texts won't wrap. You want to override this style by setting it back to `white-space: normal`.

E.g.

<p:column width="200" styleClass="wrap">

with this CSS

.ui-datatable tbody td.wrap {
    white-space: normal;
}

See also:

- How do I override default PrimeFaces CSS with custom styles?

Problem

I have a data table in my application. One column have heavy data which increasing the width of table. I want to split the data to two or more lines in that column. I have tried by setting width for that column but data did't split and doesn't show total data. ``` <p:column headerText="#{msgs['exception.label.exceptionMsg']}" width="200"> <h:outputText value="#{exception.exceptionMsg}"/> </p:column> ``` How can i split the data?

Original source

Related problems