Multiline cell in 2nd level composition is not working

HI
I have Entities of 2 levels composition where I have checked multiline-cell both the tables but only first level composition table is scrolling the lines but not the 2nd level composition table as follows:
44%20AM

        <groupBox id="annualObjectiveLineBox"
                  caption="msg://com.inteacc.erp.entity.td/AnnualObjective.annualObjectiveLine">
            <table id="annualObjectiveLineTable"
                   multiLineCells="true"
                   width="100%">
                <actions>
                    <action id="create"
                            openType="THIS_TAB"/>
                    <action id="edit"/>
                    <action id="remove"/>
                </actions>
                <columns>
                    <column id="objectiveNumber"/>
                    <column id="name"/>
                    <column id="description"/>
                    <column id="weight"/>
                </columns>
                <rows datasource="annualObjectiveLineDs"/>
                <buttonsPanel>
                    <button id="addObjBtn"
                            action="annualObjectiveLineTable.create"
                            caption="NEW OBJECTIVE"/>
                    <button action="annualObjectiveLineTable.edit"/>
                    <button action="annualObjectiveLineTable.remove"
                            caption="DELETE"/>
                </buttonsPanel>
            </table>
            <table id="annualObjectiveLineEvaluationTable"
                   editable="true"
                   height="200px"
                   multiLineCells="true"
                   width="100%">
                <actions>
                    <action id="edit"
                            openType="DIALOG"/>
                </actions>
                <columns>
                    <column id="employeeSelfEvaluation"
                            editable="true"/>
                </columns>
                <rows datasource="annualObjectiveLineEvaluationDs"/>
                <buttonsPanel>
                    <button/>
                    <button action="annualObjectiveLineEvaluationTable.edit"/>
                </buttonsPanel>
            </table>
        </groupBox>

Isn’t supported?

It works when I use GeneratedColumn option. However, the height of the row is not changed dynamically based on the contents.

  annualObjectiveLineEvaluationTable.addGeneratedColumn("employeeSelfEvaluation", client -> {
        ResizableTextArea field = componentsFactory.createComponent(ResizableTextArea.class);
        field.setWidth("100%");
        field.setDatasource(annualObjectiveLineEvaluationTable.getItemDatasource(client), "employeeSelfEvaluation");
        return field;
    });

I want the row height is changed based on contents without using the vertical scroll-bar.
While multiline works with read-only mode, the row doesn’t resize right away after edit. AFter I have saved and loaded then the row height is changed, how can I change the table row height after edit?
10%20AM

Summary: How can I have an editable multiline table cell with variable row height?

  1. If I use resizable table Cells, it stops working when I make it editable.
  2. If I use TextArea in tableColumn, multi-line editable option works but the height of the row becomes fixed. How can I make it variable vertically according to the actual content?

Hi,

TextArea doesn’t support auto heigh, but you can change it programmatically, e.g.

@Override
public void init(Map<String, Object> params) {
    productsTable.addGeneratedColumn("name", entity -> {
        TextArea textArea = componentsFactory.createComponent(TextArea.class);
        textArea.setDatasource(productsTable.getItemDatasource(entity), "name");
        textArea.setRows(1);
        textArea.setWidthFull();

        textArea.setTrimming(false);
        textArea.setTextChangeEventMode(TextInputField.TextChangeEventMode.EAGER);
        textArea.addTextChangeListener(textChangeEvent -> {
            int lines = countLines(textChangeEvent.getText());
            textArea.setRows(lines);
        });
        return textArea;
    });
}

private static int countLines(String str){
    String[] lines = str.split("\r\n|\r|\n");
    return  lines.length;
}

Regards,
Gleb

Thank you Gleb. It’s working when I edit the field (see the area under Managers comment).
13%20PM

However, we I reopen the Editor it goes back to a single row. How Can I bring all rows visible by default?

25%20PM

Hi,

Replace textArea.setRows(1); with textArea.setRows(countLines(entity.getName());

Thank you so much Gleb. This is exactly what I was looking for.