From eba0c3dd709f60a123860a609a50daa5558588d4 Mon Sep 17 00:00:00 2001 From: Henrik Paul Date: Tue, 2 Sep 2014 13:15:21 +0300 Subject: Fixes exception while hiding the last Grid column (#13334) Change-Id: Icdb8b9609c005a8d59a8c6f3c75523790bb65348 --- client/src/com/vaadin/client/ui/grid/Grid.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/ui/grid/Grid.java b/client/src/com/vaadin/client/ui/grid/Grid.java index cd9b615c4b..2b0bbc9f05 100644 --- a/client/src/com/vaadin/client/ui/grid/Grid.java +++ b/client/src/com/vaadin/client/ui/grid/Grid.java @@ -883,7 +883,17 @@ public class Grid extends Composite implements return; } - this.visible = visible; + /* + * We need to guarantee that both insertColumns and removeColumns + * have this particular column accessible. Therefore, if we're + * turning the column visible, it's set before the other logic. + * Analogously, if we're turning the column invisible, we do that + * only after the logic has been performed. + */ + + if (visible) { + this.visible = true; + } if (grid != null) { int index = findIndexOfColumn(); @@ -895,7 +905,13 @@ public class Grid extends Composite implements } else { conf.removeColumns(index, 1); } + } + if (!visible) { + this.visible = false; + } + + if (grid != null) { for (HeaderRow row : grid.getHeader().getRows()) { row.calculateColspans(); } -- cgit v1.2.3