Description hint on Table row

Hello! How to add description hint on

row?

Thanks for support!

1 Like

Hi,

Unfortunately, the Table component hasn’t such functionality out of the box. But, you can use generated columns with Label components with the specified descriptions.


customerTable.addGeneratedColumn("name", entity -> {
	Label label = componentsFactory.createComponent(Label.class);
	label.setValue(entity.getName());
	label.setDescription("Custom description");
	return label;
});

Alternatively, you can use DataGrid component, which has special description provider. See this sample and documentation about setCellDescriptionProvider() and setRowDescriptionProvider() methods.

Regards,

Gleb

The third option is to unwrap Table to Vaadin table and use setItemDescriptionGenerator


customerTable.unwrap(com.vaadin.ui.Table.class)
                .setItemDescriptionGenerator((source, itemId, propertyId) -> {
                    if (propertyId == null) {
                        return "Row description";
                    } else if (propertyId == NAME_COLUMN_PROPERTY_ID) {
                        return "Cell description";
                    }
                    return null;
                });

Regards,

Gleb

1 Like