summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java5
-rw-r--r--server/src/main/java/com/vaadin/ui/Grid.java25
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/GridClientRpc.java7
3 files changed, 32 insertions, 5 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
index e94493757e..34913910cb 100644
--- a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
@@ -241,6 +241,11 @@ public class GridConnector extends AbstractListingConnector
}
});
}
+
+ @Override
+ public void recalculateColumnWidths() {
+ getWidget().recalculateColumnWidths();
+ }
});
getWidget().addSortHandler(this::handleSortEvent);
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java
index 141130b7a2..dbaff46181 100644
--- a/server/src/main/java/com/vaadin/ui/Grid.java
+++ b/server/src/main/java/com/vaadin/ui/Grid.java
@@ -403,11 +403,12 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
*
* <p>
* Usage:
+ *
* <pre>
* grid.addContextClickListener(event -&gt; Notification.show(
- * ((GridContextClickEvent&lt;Person&gt;)event).getItem() + " Clicked")
- * );
+ * ((GridContextClickEvent&lt;Person&gt;) event).getItem() + " Clicked"));
* </pre>
+ *
* @param <T>
* the grid bean type
*/
@@ -2766,6 +2767,19 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
}
/**
+ * Requests that the column widths should be recalculated.
+ * <p>
+ * In most cases Grid will know when column widths need to be recalculated
+ * but this method can be used to force recalculation in situations when
+ * grid does not recalculate automatically.
+ *
+ * @since 8.1.1
+ */
+ public void recalculateColumnWidths() {
+ getRpcProxy(GridClientRpc.class).recalculateColumnWidths();
+ }
+
+ /**
* Sets the details component generator.
*
* @param generator
@@ -3396,8 +3410,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
* happens.
*
* @param listener
- * the context click listener to add, not null
- * actual event provided to the listener is {@link GridContextClickEvent}
+ * the context click listener to add, not null actual event
+ * provided to the listener is {@link GridContextClickEvent}
* @return a registration object for removing the listener
*
* @since 8.1
@@ -3405,7 +3419,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
* @see Registration
*/
@Override
- public Registration addContextClickListener(ContextClickEvent.ContextClickListener listener) {
+ public Registration addContextClickListener(
+ ContextClickEvent.ContextClickListener listener) {
return super.addContextClickListener(listener);
}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/GridClientRpc.java b/shared/src/main/java/com/vaadin/shared/ui/grid/GridClientRpc.java
index b560d6a14e..4fbc494bc1 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/grid/GridClientRpc.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/grid/GridClientRpc.java
@@ -50,4 +50,11 @@ public interface GridClientRpc extends ClientRpc {
* Command client Grid to scroll to the last row.
*/
public void scrollToEnd();
+
+ /**
+ * Command client Grid to recalculate column widths.
+ *
+ * @since 8.1.1
+ */
+ public void recalculateColumnWidths();
}