From fb01d9a438f5c0f89f220e46002a31d870fe6b3b Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Tue, 14 May 2019 15:05:12 +0300 Subject: Add handling for completely empty Grid's column width calculations. (#11569) Fixes #11557 --- client/src/main/java/com/vaadin/client/widgets/Escalator.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java index c559c36c18..c60358e449 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -4669,6 +4669,9 @@ public class Escalator extends Widget double maxWidth = Math.max(headerWidth, Math.max(bodyWidth, footerWidth)); + if (maxWidth < 0 && header.getRowCount() == 0 && body.getRowCount() == 0 && footer.getRowCount() == 0) { + maxWidth = 0; + } assert maxWidth >= 0 : "Got a negative max width for a column, which should be impossible."; return maxWidth; } @@ -4681,7 +4684,10 @@ public class Escalator extends Widget double minWidth = Math.max(headerWidth, Math.max(bodyWidth, footerWidth)); - assert minWidth >= 0 : "Got a negative max width for a column, which should be impossible."; + if (minWidth < 0 && header.getRowCount() == 0 && body.getRowCount() == 0 && footer.getRowCount() == 0) { + minWidth = 0; + } + assert minWidth >= 0 : "Got a negative min width for a column, which should be impossible."; return minWidth; } -- cgit v1.2.3