diff --git a/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/EmptyLabelGridHelper.java b/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/EmptyLabelGridHelper.java index 1538e28..a5d8e23 100644 --- a/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/EmptyLabelGridHelper.java +++ b/src/main/java/com/flowingcode/vaadin/addons/gridhelpers/EmptyLabelGridHelper.java @@ -48,10 +48,7 @@ class EmptyLabelGridHelper implements Serializable { void setEmptyGridLabel(Component component) { Grid grid = helper.getGrid(); - if (emptyLabel != null) { - emptyLabel.getElement().removeFromParent(); - emptyLabel = null; - } + emptyLabel = component; if (registration != null) { registration.remove(); @@ -59,8 +56,6 @@ void setEmptyGridLabel(Component component) { } if (component != null) { - emptyLabel = component; - DataProviderListener listener = ev -> component.setVisible(grid.getDataProvider().size(new Query<>()) == 0); registration = grid.getDataProvider().addDataProviderListener(listener);