Cells with paragraphs. How to keep the paragraphs and not merge them?
Cells with paragraphs. How to keep the paragraphs and not merge them?
How can I prevent a paragraph to merge?
I have paragraphs in some of the cells in my editor table (serverside). So something like this:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
In mysql the paragraphs still exist. In the table in the frontend the result is this though:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet
How can I keep the paragraphs in the editor table in the frontend as well?
Edit: I just found this: https://www.datatables.net/forums/discussion/845/line-breaks-paragraphs-etc-in-table-cells
How can I "If server-side, then you could just insert a blank set of TR / TD elements where needed by parsing through the result set."?
This question has an accepted answers - jump to answer
Answers
You need to format it using HTML. This is true in any HTML document and not just DataTables. White space is more or less meaningless in HTML.
One option would be use to
columns.render
to add the required line breaks:If you want to use
p
tags you'd need to use something a little more complex.One other option is to use the
white-space
option in CSS. Seeing it towhite-space: pre-wrap
should do it I think.Allan
This did the magic. Excellent. Thanks a lot!