Add TextArea to cell in Grid

I have the following code

        Grid grid = new Grid();
        grid.setSelectionMode(SelectionMode.MULTI);
        grid.setSizeFull();


        grid.addColumn("Phase", TextArea.class);
        grid.addColumn("Inhaltlicher Verlauf", String.class);
 
        grid.addRow("Hinführung", "Demo1");
        grid.addRow("Hinführung", "Demo1");
        grid.addRow("Hinführung", "Demo1");

grid.addRow (“Hinführung”, “Demo1”) doesn’t work.
Why?

when you define first column as type TextArea, you must provide a TextArea object in the first argument of addRow(), same as colum2, where you define type “String”, and “Demo1” is fine here.
Mani

When i write the following code, it doesn’t work

        TextArea textArea = new TextArea();
        textArea.setValue("bb");
        Grid grid = new Grid();

        grid.addColumn("Phase", TextArea.class);
        grid.addColumn("Inhaltlicher Verlauf", String.class);
 
        grid.addRow(textArea, "Demo1");
        grid.addRow(textArea, "Demo1");

It writes not “bb” in the grid-cell
it wirtes in the grid-cell “com.vaadin.ui.TextArea@6a629351”
Why?

the following code also doesn’t work

grid.addRow(textArea.getValue(), "Demo1");

Hi,
Sorry, my previous answer was probably way too short, was just explaining why you encountered the error described.

Don’t know what you inted to achieve.
a “Grid” per default is not a “Table”, which allows to configure cells to consist of arbitrary Vaadin controls,
but a control with very specific assumptions, but as long as they fit to your need, it manages this in a very versatile way.

Data in the cells is managed via Renderers and Converters. The default renderer is the TextRenderer which converts the data #asString(), this is what you see. As with “Label” this renderer puts everything into one line (as it escapes all angular brackets, and html ignores line feeds). So it might be easiest if you use the HtmlRenderer, which even gives you the option to format your html with further effects; anyway
etc. will work.

If you want to see multi line text, please remember that every row in a Grid has to be of the same size. The height of a row can be specified via css.

thanks