-
Notifications
You must be signed in to change notification settings - Fork 721
Open
Description
Vaadin Framework version - 8.24.0
Google Chrome Version 125.0.6422.77 (Official Build) (64-bit)
Windows 11 Enterprise Version 23H2
Component in grid header is not displayed correctly if you set it from background thread.

To reproduce bug you should change header from background thread:
protected void init(VaadinRequest vaadinRequest) {
grid.getDefaultHeaderRow().getCell(columnId)
.setComponent(new HorizontalLayout(new Label("Status")));
CompletableFuture.supplyAsync(() -> {
try {
Thread.sleep(2000);
} catch (InterruptedException ignored) {}
return "";
})
.whenComplete((s, thr) -> {
UI ui = getUI();
ui.access(() -> {
grid.getDefaultHeaderRow().getCell(columnId)
.setComponent(createLayoutForStatusColumnInHeader());
ui.push();
});
});
}
private HorizontalLayout createLayoutForStatusColumnInHeader() {
Button button = new Button();
button.addStyleNames(
ValoTheme.BUTTON_SMALL,
ValoTheme.BUTTON_ICON_ONLY,
ValoTheme.BUTTON_BORDERLESS
);
button.setIcon(VaadinIcons.REFRESH);
button.addClickListener(clickEvent -> Notification.show("refresh!"));
HorizontalLayout horizontalLayout = new HorizontalLayout();
Label label = new Label("Status");
horizontalLayout.addComponentsAndExpand(label);
horizontalLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
horizontalLayout.addComponent(button);
horizontalLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER);
return horizontalLayout;
}Push mode is @Push(value = PushMode.MANUAL, transport = Transport.LONG_POLLING)
Also you can find full code in repo-vaadin8-component-in-grid-header-bug.
Metadata
Metadata
Assignees
Labels
No labels