diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Grid.java | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index 64a09d8d96..58945bfc46 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -2056,6 +2056,40 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, } /** + * Sets whether Grid should handle events in this Column from Components + * and Widgets rendered by certain Renderers. By default the events are + * not handled. + * <p> + * <strong>Note:</strong> Enabling this feature will for example select + * a row when a component is clicked. For example in the case of a + * {@link ComboBox} or {@link TextField} it might be problematic as the + * component gets re-rendered and might lose focus. + * + * @param widgetEventsAllowed + * {@code true} to handle events; {@code false} to not + * @return this column + */ + public Column<T, V> setWidgetEventsAllowed( + boolean widgetEventsAllowed) { + if (getState(false).widgetEventsAllowed != widgetEventsAllowed) { + getState().widgetEventsAllowed = widgetEventsAllowed; + } + return this; + } + + /** + * Gets whether Grid is handling the events in this Column from + * Component and Widgets. + * + * @see #setWidgetEventsAllowed(boolean) + * + * @return {@code true} if handling events; {@code false} if not + */ + public boolean isWidgetEventsAllowed() { + return getState(false).widgetEventsAllowed; + } + + /** * Gets the grid that this column belongs to. * * @return the grid that this column belongs to, or <code>null</code> if @@ -2589,8 +2623,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, * <p> * You can add columns for nested properties with dot notation, eg. * <code>"property.nestedProperty"</code> - * + * * @param propertyName * the property name of the new column, not <code>null</code> * @param renderer |