Force DataTable to wrap text
Force DataTable to wrap text
I am trying to create a table layout detailing customer notes and other text entered into a textbox. I did not limit the user's ability to enter data, so some of this text is rather lengthy.
When I create a table with DataTables, it prevents the word wrap functionality, and even ignores \n\r. The resultant displayed width table is huge! All the text is on one line and the table cells are text width, This makes the table literally unreadable.
If I display the table without data tables, it displays as I would expect (wrapping the text within the cell), so the issue is in DataTables API/CSS somewhere (most likely CSS)
Is there a way to allow columns to display in a more compact manner and turn ON word wrap?
This question has an accepted answers - jump to answer
Answers
You can try adding
wrap
to your table class. The Styling doc discusses the default Datatables styles.Kevin