In Vaadin Framework 8.1 app, on the Grid widget, how does one clear a column renderer after setting it?
We can set a renderer on a Grid.Column
by calling setRenderer
. How to un-set it?
Passing null
results in a null pointer exception:
java.lang.NullPointerException: Renderer can not be null
The default behavior before setting the renderer seems to be simply calling toString
on the column’s objects.
➟ How get back to that default behavior?
There is no way to ask Vaadin to revert to default.
Before setting the new renderer, you can ask for the existing default renderer.
Renderer<?> r = this.columnInstant.getRenderer() ;
Then later re-apply it.
myGridColumn.setRenderer( r ) ;
Commonly, the default renderer is com.vaadin.ui.renderers.TextRenderer
. You can instantiate a new one if that is more convenient than retaining a reference to the old one.
myGridColumn.setRenderer( new com.vaadin.ui.renderers.TextRenderer() ) ;