How to display a very large single line string as multiple lines in a table cell?

How to display a very large single line string as multiple lines in a table cell?

Aravind_BodduAravind_Boddu Posts: 4Questions: 2Answers: 0

I'm using server side processing for data tables. I've a long string to be displayed in the data table. So far am displaying that by truncating to specific character length. But now my requirement is to display that in multiple lines of the cell. If I tried to do that, the cell width was increased by showing the string in one line and looking ugly. How to display into multiple lines and not increasing the width of the cell. I've attached the image of that issue.

Answers

  • InnocentmInnocentm Posts: 11Questions: 3Answers: 0

    I would advise limiting the cell width by applying fixed width to your "th" element, either using inline styling like

    <th width="150px">Comments</th>
    

    or using external css. If you use external styling make sure you give that specific "th" an id

  • rf1234rf1234 Posts: 2,949Questions: 87Answers: 416

    https://datatables.net/reference/option/columns.width
    using the data tables initialization options instead.

This discussion has been closed.