diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/widgets/Grid.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index 28c26893ef..f96ee69010 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -1248,6 +1248,23 @@ public class Grid<T> extends ResizeComposite implements private static final String ERROR_CLASS_NAME = "error"; private static final String NOT_EDITABLE_CLASS_NAME = "not-editable"; + ScheduledCommand fieldFocusCommand = new ScheduledCommand() { + private int count = 0; + + @Override + public void execute() { + Element focusedElement = WidgetUtil.getFocusedElement(); + if (focusedElement == grid.getElement() + || focusedElement == Document.get().getBody() + || count > 2) { + focusColumn(focusedColumnIndex); + } else { + ++count; + Scheduler.get().scheduleDeferred(this); + } + } + }; + /** * A handler for events related to the Grid editor. Responsible for * opening, moving or closing the editor based on the received event. @@ -1807,7 +1824,11 @@ public class Grid<T> extends ResizeComposite implements } if (i == focusedColumnIndex) { - focusColumn(focusedColumnIndex); + if (BrowserInfo.get().isIE8()) { + Scheduler.get().scheduleDeferred(fieldFocusCommand); + } else { + focusColumn(focusedColumnIndex); + } } } else { cell.addClassName(NOT_EDITABLE_CLASS_NAME); |