Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 3 weeks ago
ComponentRenderer for Grid-Cells doesn't create the Components
Hi everybody,
I want to use the Addon ComponentRenderer: https://vaadin.com/directory#!addon/componentrenderer
It renders standard components in a Grid, so you can build a cell with a text and a picture in one Gridcell for example.
But all my tries are not working. I just get an empty Grid as result.
I am thankful for any help or advice. Thanks!
package view;
import java.util.ArrayList;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Component;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import controller.TippappManager;
import entities.*;
import model.UserDaten;
import de.datenhahn.vaadin.componentrenderer.grid.ComponentGenerator;
import de.datenhahn.vaadin.componentrenderer.grid.ComponentGridDecorator;
public class ClassicGrid extends VerticalLayout {
public ClassicGrid (TippappManager manager, UserDaten userDaten) {
setSizeFull();
setMargin(true);
setSpacing(true);
Grid grid = new Grid();
grid.setContainerDataSource(new BeanItemContainer<Spiel>(Spiel.class));
ComponentGridDecorator<Spiel> componentGridDecorator = new ComponentGridDecorator<>(grid, Spiel.class);
int turnierID = userDaten.getUserTippgruppeByID(manager.getCurrentTippgruppe()).getTurnierId();
ArrayList<Spiel> offeneSpiele = userDaten.getSpiele().get(turnierID);
componentGridDecorator.addAll(offeneSpiele);
grid.setSizeFull();
grid.setEditorEnabled(true);
grid.setEditorBuffered(false);
ComponentGenerator<Spiel> generatorIcon = new ComponentGenerator<Spiel>() {
@Override
public Component getComponent(Spiel bean) {
return new Label(FontAwesome.HOURGLASS_2.getHtml(), ContentMode.HTML);
}
};
ComponentGenerator<Spiel> generatorText = new ComponentGenerator<Spiel>() {
@Override
public Component getComponent(Spiel bean) {
return new Label(FontAwesome.HOURGLASS_2.getHtml(), ContentMode.HTML);
}
};
componentGridDecorator.addComponentColumn("icon", generatorIcon);
componentGridDecorator.addComponentColumn("text", generatorText);
// always display the details column
grid.setFrozenColumnCount(1);
grid.setColumns( "icon", "text");
addComponent(grid);
// setExpandRatio(grid, 1.0f);
}
}
Last updated on
+1
Hi,
Did you find the reason why grid was not showing? I am having same issue, I am using
ComponentRenderer 1.0.3 and Vaadin version 7.7.9
Thanks.
Last updated on
You cannot reply to this thread.