summaryrefslogtreecommitdiffstats
path: root/documentation/components/components-grid.asciidoc
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/components/components-grid.asciidoc')
-rw-r--r--documentation/components/components-grid.asciidoc16
1 files changed, 15 insertions, 1 deletions
diff --git a/documentation/components/components-grid.asciidoc b/documentation/components/components-grid.asciidoc
index e35f2b0aac..6a18a54897 100644
--- a/documentation/components/components-grid.asciidoc
+++ b/documentation/components/components-grid.asciidoc
@@ -403,9 +403,23 @@ You set the column renderer in the [classname]#Grid.Column# object as follows:
[source, java]
----
// the type of birthYear is a number
-Column<Integer> bornColumn = grid.addColumn(Person:getBirthYear,
+Column<Person, Integer> bornColumn = grid.addColumn(Person:getBirthYear,
new NumberRenderer("born in %d AD"));
----
+
+Changing the renderer during runtime is also possible, but for type safety
+you should store the column reference with data types for doing this.
+When you change the renderer, the content of Grid is refreshed.
+
+[source, java]
+----
+Column<Person, Integer> ageColumn = grid.addColumn(Person::getBirthYear);
+// The default renderer is TextRenderer
+addComponent(new Button("Change renderer",
+ clickEvent -> ageColumn.setRenderer(new NumberRenderer())
+));
+----
+
The following renderers are available, as defined in the server-side
[package]#com.vaadin.ui.renderers# package: