diff --git a/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/AbstractColumn.java b/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/AbstractColumn.java index c5342c570f5..0868af9a985 100644 --- a/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/AbstractColumn.java +++ b/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/AbstractColumn.java @@ -73,12 +73,14 @@ public Grid> getGrid() { /** * {@inheritDoc} *
- * Note that column related data is sent to the client side even if the - * column is invisible. Use {@link Grid#removeColumn(Column)} to remove - * column (or don't add the column all) and avoid sending extra data. + * By default, every added column sends data to the client side regardless + * of its visibility state. To avoid sending extra data, either remove the + * column using {@link Grid#removeColumn(Column)} or use + * {@link Column#setGenerateDataWhenHidden(boolean)}. *
* * @see Grid#removeColumn(Column) + * @see Column#setGenerateDataWhenHidden(boolean) */ @Override public void setVisible(boolean visible) { diff --git a/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/Grid.java b/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/Grid.java index 51112cce321..3da9ee36ecb 100755 --- a/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/Grid.java +++ b/vaadin-grid-flow-parent/vaadin-grid-flow/src/main/java/com/vaadin/flow/component/grid/Grid.java @@ -31,6 +31,7 @@ import java.util.Set; import java.util.function.BiFunction; import java.util.function.BinaryOperator; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; @@ -432,9 +433,10 @@ public static void setDefaultMultiSortPriority(MultiSortPriority priority) { * Server-side component for the {@code- * Every added column sends data to the client side regardless of its - * visibility state. Don't add a new column at all or use - * {@link Grid#removeColumn(Column)} to avoid sending extra data. + * By default, every added column sends data to the client side regardless + * of its visibility state. To avoid sending extra data, either remove the + * column using {@link Grid#removeColumn(Column)} or use + * {@link #setGenerateDataWhenHidden(boolean)}. *
* * @param+ * Setting this property to {@code false} will prevent the data for this + * column from being generated and sent to the client when the column is + * hidden. Alternatively, you can remove the column using + * {@link Grid#removeColumn(Column)} or avoid adding the column + * altogether. + *
+ * + * @param generateDataWhenHidden + * {@code true} to generate data even when the column is + * hidden, {@code false} otherwise + * @return this column + */ + public Column@@ -1859,9 +1945,10 @@ protected GridArrayUpdater createDefaultArrayUpdater( * see {@link #addColumn(Renderer)}. *
*- * Every added column sends data to the client side regardless of its - * visibility state. Don't add a new column at all or use - * {@link Grid#removeColumn(Column)} to avoid sending extra data. + * By default, every added column sends data to the client side regardless + * of its visibility state. To avoid sending extra data, either remove the + * column using {@link #removeColumn(Column)} or use + * {@link Column#setGenerateDataWhenHidden(boolean)}. *
*
* NOTE: This method is a shorthand for
@@ -1892,9 +1979,10 @@ public Column
- * Every added column sends data to the client side regardless of its - * visibility state. Don't add a new column at all or use - * {@link Grid#removeColumn(Column)} to avoid sending extra data. + * By default, every added column sends data to the client side regardless + * of its visibility state. To avoid sending extra data, either remove the + * column using {@link #removeColumn(Column)} or use + * {@link Column#setGenerateDataWhenHidden(boolean)}. *
* * @param valueProvider @@ -1954,10 +2042,12 @@ private String formatValueToSendToTheClient(Object value) { * NOTE: Using {@link ComponentRenderer} is not as efficient as the * built in renderers or using {@link LitRenderer}. * + * *- * Every added column sends data to the client side regardless of its - * visibility state. Don't add a new column at all or use - * {@link Grid#removeColumn(Column)} to avoid sending extra data. + * By default, every added column sends data to the client side regardless + * of its visibility state. To avoid sending extra data, either remove the + * column using {@link #removeColumn(Column)} or use + * {@link Column#setGenerateDataWhenHidden(boolean)}. *
* * @param componentProvider @@ -1983,9 +2073,10 @@ public- * Every added column sends data to the client side regardless of its - * visibility state. Don't add a new column at all or use - * {@link Grid#removeColumn(Column)} to avoid sending extra data. + * By default, every added column sends data to the client side regardless + * of its visibility state. To avoid sending extra data, either remove the + * column using {@link #removeColumn(Column)} or use + * {@link Column#setGenerateDataWhenHidden(boolean)}. *
* * @see Column#setComparator(ValueProvider) @@ -2022,9 +2113,10 @@ public- * Every added column sends data to the client side regardless of its - * visibility state. Don't add a new column at all or use - * {@link Grid#removeColumn(Column)} to avoid sending extra data. + * By default, every added column sends data to the client side regardless + * of its visibility state. To avoid sending extra data, either remove the + * column using {@link #removeColumn(Column)} or use + * {@link Column#setGenerateDataWhenHidden(boolean)}. *
*
* NOTE: This method is a shorthand for
@@ -2060,9 +2152,10 @@ public Column
- * Every added column sends data to the client side regardless of its - * visibility state. Don't add a new column at all or use - * {@link Grid#removeColumn(Column)} to avoid sending extra data. + * By default, every added column sends data to the client side regardless + * of its visibility state. To avoid sending extra data, either remove the + * column using {@link #removeColumn(Column)} or use + * {@link Column#setGenerateDataWhenHidden(boolean)}. *
* * @param renderer @@ -2167,9 +2260,10 @@ protected BiFunction- * Every added column sends data to the client side regardless of its - * visibility state. Don't add a new column at all or use - * {@link Grid#removeColumn(Column)} to avoid sending extra data. + * By default, every added column sends data to the client side regardless + * of its visibility state. To avoid sending extra data, either remove the + * column using {@link #removeColumn(Column)} or use + * {@link Column#setGenerateDataWhenHidden(boolean)}. *
* *
@@ -2208,9 +2302,10 @@ public Column
- * Every added column sends data to the client side regardless of its
- * visibility state. Don't add a new column at all or use
- * {@link Grid#removeColumn(Column)} to avoid sending extra data.
+ * By default, every added column sends data to the client side regardless
+ * of its visibility state. To avoid sending extra data, either remove the
+ * column using {@link #removeColumn(Column)} or use
+ * {@link Column#setGenerateDataWhenHidden(boolean)}.
*
* Note: This method can only be used for a Grid created
* from a bean type with {@link #Grid(Class)}.
- *
*
- * Every added column sends data to the client side regardless of its
- * visibility state. Don't add a new column at all or use
- * {@link Grid#removeColumn(Column)} to avoid sending extra data.
+ * By default, every added column sends data to the client side regardless
+ * of its visibility state. To avoid sending extra data, either remove the
+ * column using {@link #removeColumn(Column)} or use
+ * {@link Column#setGenerateDataWhenHidden(boolean)}.
*
- * Every added column sends data to the client side regardless of its
- * visibility state. Don't add a new column at all or use
- * {@link GridPro#removeColumn(Column)} to avoid sending extra data.
+ * By default, every added column sends data to the client side regardless
+ * of its visibility state. To avoid sending extra data, either remove the
+ * column using {@link #removeColumn(Column)} or use
+ * {@link Column#setGenerateDataWhenHidden(boolean)}.
*
* @param