Add more components in one table's cell (on columns)

Hi he some piece of code, i need to ad two component (like two Labels for example with different style) in one cell of a classic table (Vaadin 7.xx).

attached an image to show hoe need to do.

Someone can help us?

private ArticleCartTable buildShoppingCartComponents() throws SQLException {

	shoppingChartTable = new ArticleCartTable(........) {

		@Override
		protected void refreshFooter() {
			super.refreshFooter();
			try {
				...GETRECORD REQUEST...
				}
			} catch (Exception e) {
				WebAppNotifier.notify(e);
			}
		}

	};
	shoppingChartTable.setCaption("Cart");
	shoppingChartTable.setWidth("100%");
	shoppingChartTable.setPageLength(0);
	shoppingChartTable.setIcon(FontAwesome.SHOPPING_CART);
	return shoppingChartTable;
}

.....

public class ArticleCartTable extends Table {

..... for complete table call this method (article name column, see in image attached)

private void addArticleNameColumn() {
	addGeneratedColumn(ProjectEnum.ARTICLE, (source, itemId, columnId) -> {
		ShoppingCart sc = (ShoppingCart) itemId;
		LabelCustom labelCustom = new LabelCustom(sc.getIdArticle().getName(), false);
		labelCustom.setWidth("100%");
		return labelCustom;
	});
	setColumnExpandRatio(ProjectEnum.ARTICLE, 1);
}

Thanks
17163175.png

Have you tried using a HorizontalLayout that contains the two labels?

-Olli

Hi Olli,

in my profile is the exact face i did when i read your previous post,

sometimes we are so busy in complicated things that you neglect the simplest solution … in that return now there is a vesticalLayout…

thank you very much
17164165.jpg

Great! :slight_smile:

Hi Olli

there are someone can help me to understand how develop that i write in my last post?

Push Notification from WebApps (Vaadin) like Native Android Notification an

thanks
have a nice day