I'm trying to display my boolean values as a checkbox in a vaadin grid. I can't use the multi selection mode because i need two columns with checkboxes. The columns of the Checkboxes shell have a Caption but the Checkboxes itself shell be without a caption. Does anyone have an idea ?
相关问题
- Vaadin Change the default Session Expired Notifica
- Change Maven-driven project based on Vaadin 11 to
- Validation icon not shown in Table fields
- Not able to save uploaded file on server using GOL
- Open pdf file from menubar using Vaadin
相关文章
- Spring Security + Vaadin: How to create custom non
- How to perform an Load Test/Performance Test with
- save file on server, java web application [duplica
- Scoped Spring events possible?
- How to specify a button to open an URL?
- Understanding Vaadin Flow / Vaadin 10
- How to add d3 (javascript) to a vaadin application
- How do I fix 'com.vaadin.DefaultWidgetSet'
I suggest to use this repo https://github.com/vaadin/grid-renderers-collection-addon. This project is developed by Vaadin devs and it provides CheckboxRenderer class. You can see it in demo but using it is very simple.
First you have to add repository and dependency into your project. In maven it looks like this:
Then you can use it like this:
You can also easily add listener:
You have to add generated columns for your checkboxes
You can find more detailed example in here in section "GeneratedPropertyContainer"
https://vaadin.com/docs/-/part/framework/datamodel/datamodel-container.html#datamodel.container.gpc
EDIT: Also set `ComponentRenderer' for your column
If you only need a read-only checkbox, this worked for me:
HtmlRenderer is provided by the Vaadin framework, and the boolean converter looks like this:
This will give you a native browser checkbox, however, not a Vaadin CheckBox.