Scott Barbour
Scott Barbour

Reputation: 454

Vaadin - ListSelect - set focus on selected item?

I'm currently using the ListSelect component of Vaadin (version 7.x) and would like to highlight the option I've set as the default selection using the setValue() method - similar to what happens for the onClick() event when the background colour changes to blue and the text colour to white.

Does anyone know how to do this?

ListSelect itemList = new ListSelect("Please select an item:");

itemList.add(initialItem)

for(Item item: items) {
    if(!item.equals(initialItem.getName())) {
        //add item
    }
itemList.setValue(initialItem.getName());

//set focus on intial item to make it stand out from all other items

Thanks

Upvotes: 0

Views: 747

Answers (1)

ths
ths

Reputation: 2942

use

itemList.select(initialItem)

Upvotes: 3

Related Questions