Using an ItemIconGenerator for a ListSelect

I am looking for a way to add icons on to items in a listSelect but found no way to do it.
When trying it with an ItemIconGenerator it says: “The method setItemIconGenerator(IconGenerator) from the type AbstractListing is not visible”

Why is that and is there another way to add icons to a ListSelect?

Thanks in advance :slight_smile:

Thank you for your answer.

It would be a nice thing to have but then I’ll use a combobox for this.

Greetings
Karsten

The setItemIconGenerator is protected method in AbstractListing, which is implemented as public in implementing classes (like ComboBox). So if the implementing classs is not supporting this feature, you will get this “is not visible” error.

Also note in documentation


https://vaadin.com/docs/v8/framework/components/components-selection.html#components.selection

"Item Icons

You can set an icon for each item with setItemIconGenerator(), in a fashion similar to captions. Notice, however, that icons are not supported in NativeSelect, TwinColSelect, and some other selection components and modes. This is because HTML does not support images inside the native select elements."