From 35e441f2ecf19b779fb99ccc58d658dc29c03d80 Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Thu, 30 Apr 2020 14:31:09 +0300 Subject: Allow replacing all columns at once when some of them are frozen. (#11978) Fixes #11824 --- client/src/main/java/com/vaadin/client/widgets/Grid.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 6d22dfc5ca..2faddaf68d 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -7398,8 +7398,17 @@ public class Grid extends ResizeComposite implements HasSelectionHandlers, } private void updateFrozenColumns() { - escalator.getColumnConfiguration() - .setFrozenColumnCount(getVisibleFrozenColumnCount()); + int visibleFrozenColumnCount = getVisibleFrozenColumnCount(); + ColumnConfiguration columnConfiguration = escalator + .getColumnConfiguration(); + if (columnConfiguration.getColumnCount() < visibleFrozenColumnCount) { + // new columns may not have got added yet, delay and check the + // correct count again + Scheduler.get().scheduleFinally(() -> columnConfiguration + .setFrozenColumnCount(getVisibleFrozenColumnCount())); + } else { + columnConfiguration.setFrozenColumnCount(visibleFrozenColumnCount); + } } private int getVisibleFrozenColumnCount() { -- cgit v1.2.3