correctly display a field
correctly display a field

Hello, how can I correctly display a field that is edited using a tag "textarea"?
In the textarea itself, everything is displayed correctly, for example:
Mike
Ruby
Ilia
And with the usual output of the table, until I started editing, the output is as follows:
Mike Ruby Ilia
This question has accepted answers - jump to:
This discussion has been closed.
Answers
that means after editing everything is ok? Then you probably don't have line feeds in the non edited text.
The first picture shows how I enter textarea.
On the second, how it is taken out of the base. I need it to be displayed in the same way as in textarea.
I guess you would need a WYSIWYG editor for this. I am using Quill for example but there are others as well.
Just take a look at the field type plug-ins here:
https://editor.datatables.net/plug-ins/field-type/
An alternative could be to check the input of the textarea server side for line breaks and then save HTML <br> tags in the field. Don't know whether that would work. You would need to experiment.
If your requirement is a line break after every word then it is even simpler: Just a renderer client side that inserts HTML <br> tags will do for that.
I use Quill because I wanted MS Word like text formatting in my text field.
Yup - I would have expected what you are seeing to happen since the textarea's newlines are just \n, which is just whitespace in HTML and HTML doesn't really care about whitespace.
The easiest option would be to use
columns.render
to change the\n
into<br>
for the HTML output: http://live.datatables.net/palabavu/2/edit .Allan