To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.
Setting Style Classes on NativeSelect Item Captions
7 years ago Feb 16, 2016 1:51pm
Hi all, we need to add style classes to some (item specific) item captions in a NativeSelect Component. However, there does not seem to be a method to accomplish this (setting an ItemStyleGenerator would be nice). Also, all captions text will be escaped without the option to turn of the escaping (pretty much hardcoded in ListBox). Writing an extension for the native select to accomplish this also seems to be rather complex.
Although the ComboBox Component offers the functionality we need, we can not use it as the customer demands usage of native components as much as possible and it would clash with our established design guidelines for this project. So we are stuck with the NativeSelect Component.
Is there any way we can add style classes to the HTML Option elements directly or somehow disable the HTML escaping for the item captions? Btw. we are using Vaadin 7.6.1. Any ideas are appreciated.