Skip to content
Advertisement

How can I display checkboxes instead of boolean in vaadin grid?

I’m working on a new application using vaadin-spring-boot-starter 21.0.7 and trying to render training database information in a Grid. I’d like to have the first column in the list be a checkbox for Active/Inactive, but I can’t figure out how to get that done. Everything I’ve seen has been for Vaadin 7 or 8. Mostly current code is in MainView.java at https://github.com/gregoryleblanc/ealOperators/tree/vaadin

Advertisement

Answer

You can do it like this for Vaadin 14 and newer. I have no experience with older versions of Vaadin.

JavaScript

The lambda may be replaced with a method reference

grid.addComponentColumn(this::createCheckboxComponent);

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement