diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-03-15 14:00:50 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-03-15 14:00:50 +0200 |
commit | c766694bec0ec16d7dc7b52f8e48f3c4056e6d1f (patch) | |
tree | 9adcbf965914c9ad9c5d84a79cecdbc6117a1234 /documentation/components | |
parent | 0fe0e727784b311e2b76f3b5a06d3a823d2006f4 (diff) | |
download | vaadin-framework-c766694bec0ec16d7dc7b52f8e48f3c4056e6d1f.tar.gz vaadin-framework-c766694bec0ec16d7dc7b52f8e48f3c4056e6d1f.zip |
Allow changing renderers after column creation (#8841)
Closes #8250
Diffstat (limited to 'documentation/components')
-rw-r--r-- | documentation/components/components-grid.asciidoc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/documentation/components/components-grid.asciidoc b/documentation/components/components-grid.asciidoc index ed66c45d2f..223be80e6f 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: |