How to put a linebreak in a cell

I have some data I want to put in my dhtmlxgrid. The xml looks like this:

This text takes up three lines.

However, in my dhtmlxgrid, I see “This text takes up three lines” all in one cell. How do I make dhtmlx put in the line breaks for me?

Make sure that you have enabled the Multiline support

mygrid.enableMultiline(true);

Yes, I do have mygrid.enableMultiline(true) in my code, and it does automatically wrap text that reaches the end of the cell, but I still cannot put a line break in my text where I want one.

Oh, I see.
In this case you may use CDATA http://docs.dhtmlx.com/doku.php?id=others:special_characters_in_xml
and
tag.
Like this:

<cell><![CDATA[This text<br/>takes up<br/>three lines]]></cell>

Is there a way to enable mutli line only for a row or cell?

there are some cells that don’t require wrapping so i don’t enable multi line.

however, even if i add a
to the cell value, height would not increase.

thanks

Hi,
You can find the answer to Your question at this sample http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/16_rows_columns_manipulations/03_grid_multiline_col.html.
Just look at the fiirst row. Columns “Book Title” and “Author”.

thanks,

another way to do it:
enableMultiline(true);

and

for those row’s you don’t want to apply multiline, force:
grid.setCellTextStyle(rowId, columnIndex, “white-space:nowrap”);

:smiley: