HI guys, good day! Im having a problem with Grid after doing some experiments with Vaadin 8. I added a component inside a grid row and I cant click or highlight the row if the mouse pointer is within the area of the component…
public HRView() {
Grid<EmployeeSummary> grid = new Grid<>();
grid.setSizeFull();
grid.setSelectionMode(Grid.SelectionMode.SINGLE);
grid.setItems(ess.findAllEmployee());
grid.addComponentColumn(e -> new EmployeeListView(e.getEmployeeName().toUpperCase(), e.getPosition().toUpperCase()))
.setCaption("Employee");
grid.setStyleGenerator(e -> "g-align");
grid.removeHeaderRow(0);
addComponent(grid);
}
....
public EmployeeListView(String employeeName,
String employeePosition) {
setWidthUndefined();
setHeight("50");
setSpacing(true);
setMargin(false);
ThemeResource resource = new ThemeResource("../hris-theme/img/profile-pic-300px.jpg");
Image img = new Image(null, resource);
img.setWidth("50");
img.setHeight("50");
img.addStyleName("profile-pic");
addComponent(img);
setComponentAlignment(img, Alignment.MIDDLE_CENTER);
Label labelName = new Label(employeeName);
labelName.addStyleName(ValoTheme.LABEL_BOLD);
Label labelPosition = new Label(employeePosition);
labelPosition.addStyleName(ValoTheme.BUTTON_TINY);
VerticalLayout layout = new VerticalLayout();
layout.setWidthUndefined();
layout.setMargin(false);
layout.setSpacing(false);
layout.addComponent(labelName);
layout.setComponentAlignment(labelName, Alignment.BOTTOM_LEFT);
layout.addComponent(labelPosition);
layout.addStyleName("profile-title");
addComponent(layout);
setExpandRatio(layout, 2);
}
Please Help…