Vaadin Grid cell not showing multiline rows

前端 未结 4 842
没有蜡笔的小新
没有蜡笔的小新 2021-02-19 02:06

With Vaadin Grid, I want to generate multiline cells for every cell that have more content in cell that overlaps its width.

I have allready tried:

  • java

4条回答
  •  执念已碎
    2021-02-19 02:45

    Another way of fitting long scrolling text into a grid column is to set a row height for the grid and use a component renderer and render a textarea in the grid which contains the text. This works good because if the text is too long the user will get a scrollbar inside the cell to see the overflowed text.

    Column screen = grid.addComponentColumn(role->{
            TextArea ta = new TextArea();
            ta.setValue(VALUE_PROVIDER_TEXT);
            ta.setStyleName("clear");
            ta.setHeight("100px");
            ta.setReadOnly(true);
            ta.setWidth("150px");
            return ta;
        });
        screen.setWidth(150);
        screen.setCaption("Screens");
        grid.setBodyRowHeight(100);
    

    and this in the css

      .v-textarea-clear{background-color: transparent;border: none;}
    

    Example

提交回复
热议问题