diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/connectors/MultiSelectionModelConnector.java | 1 | ||||
-rw-r--r-- | client/src/com/vaadin/client/widgets/Grid.java | 30 |
2 files changed, 29 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/connectors/MultiSelectionModelConnector.java b/client/src/com/vaadin/client/connectors/MultiSelectionModelConnector.java index 04c56a5b44..5d00619995 100644 --- a/client/src/com/vaadin/client/connectors/MultiSelectionModelConnector.java +++ b/client/src/com/vaadin/client/connectors/MultiSelectionModelConnector.java @@ -128,7 +128,6 @@ public class MultiSelectionModelConnector extends } }); } else if (renderer != null) { - renderer.destroy(); selectAll.removeHandler(); dataAvailable.removeHandler(); renderer = null; diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index f96ee69010..806bc6a220 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -4791,8 +4791,36 @@ public class Grid<T> extends ResizeComposite implements } if (renderer != bodyRenderer) { + // Variables used to restore removed column. + boolean columnRemoved = false; + double widthInConfiguration = 0.0d; + ColumnConfiguration conf = null; + int index = 0; + + if (grid != null + && (bodyRenderer instanceof WidgetRenderer || renderer instanceof WidgetRenderer)) { + // Column needs to be recreated. + index = grid.getColumns().indexOf(this); + conf = grid.escalator.getColumnConfiguration(); + widthInConfiguration = conf.getColumnWidth(index); + + conf.removeColumns(index, 1); + columnRemoved = true; + } + + // Complex renderers need to be destroyed. + if (bodyRenderer instanceof ComplexRenderer) { + ((ComplexRenderer) bodyRenderer).destroy(); + } + bodyRenderer = renderer; + if (columnRemoved) { + // Restore the column. + conf.insertColumns(index, 1); + conf.setColumnWidth(index, widthInConfiguration); + } + if (grid != null) { grid.refreshBody(); } @@ -5486,7 +5514,7 @@ public class Grid<T> extends ResizeComposite implements if (renderer instanceof WidgetRenderer) { try { Widget w = WidgetUtil.findWidget(cell.getElement() - .getFirstChildElement(), Widget.class); + .getFirstChildElement(), null); if (w != null) { // Logical detach |