[Table] Max text length for generated column

Dear Team,
I have a table with a generated cloumn by label as below
public Component generateSmsContentCell(VStampInfo entity) {

    Label smsContent = (Label) componentsFactory.createComponent(Label.NAME);
    smsContent.setValue("value with long content");
    return smsContent;
}

I already config this column in Table in my xml

I want to it is display wrap in row. But it is not display as my wish :frowning:
Please give me a help. Thanks!

You might want to solve this using CSS:


.v-table-cell-wrapper {
	white-space: normal;
	line-height: 22px;
	max-width: 750px; /* To limit the size that texts tend to take in tables and pushing the other columns aside, despite being set to a width */
}
1 Like

Thanks. It’s helpful for me.

Hi,

I recommend that you try to use PopupView component and show your long value content as a pop-up window.


usersTable.addGeneratedColumn("position", entity -> {
    if (entity.getPosition() != null) {
        String position = entity.getPosition();
        if (position.length() < 15) {
            return new Table.PlainTextCell(position);
        }

        PopupView popupView = componentsFactory.createComponent(PopupView.class);
        popupView.setMinimizedValue(position.substring(0, 10));

        TextArea textArea = componentsFactory.createComponent(TextArea.class);
        textArea.setEditable(false);
        textArea.setWidth("200px");
        textArea.setHeight("150px");
        textArea.setValue(position);

        popupView.setPopupContent(textArea);

        return popupView;
    }
    return null;
});

The result will be:

popup-text-cell.gif (128.9K)

4 Likes

Hi Yuriy Artamonov,
Thank you very much for your solution!
It worked very well!