diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-03-15 14:00:50 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-03-16 16:21:24 +0200 |
commit | f6888557f39f697a1911b2f8cf53dee3bfa55a65 (patch) | |
tree | 227d5bd67caa7fee2cc82bb499d2e24e29cde947 /documentation | |
parent | 188884d4c2309873e7e7144face9fb0053b18a6f (diff) | |
download | vaadin-framework-f6888557f39f697a1911b2f8cf53dee3bfa55a65.tar.gz vaadin-framework-f6888557f39f697a1911b2f8cf53dee3bfa55a65.zip |
Allow changing renderers after column creation (#8841)
Closes #8250
Diffstat (limited to 'documentation')
-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 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: |