user1593386
user1593386

Reputation: 51

Customize CSS for selectedItem in a ComboBox in ExtJs

How can I customize CSS for selected items in a ComboBox? Pass "selectedItemCls" trough "listConfig" method doesn't work. Why?

Upvotes: 0

Views: 1975

Answers (1)

lontivero
lontivero

Reputation: 5275

You have to overload the .x-boundlist-selected class. For example, if you want the selected value in read and bold, you could do the follow:

.x-boundlist-selected {
    font-weight: bold;
    background-color: red;
}​

Take a look at this working example: http://jsfiddle.net/lontivero/P9awz/1/

Update:

The selectedItemCls doesn´t not work because there is no way to change its value given it is assign in the InitComponent method:

me.selectedItemCls = baseCls + '-selected';

Then, the only way to change it is providing a value for baseCls. But if you do that, you will need to create all the family of css classes that combobox use.

Take a look at this working (even uncompleted) example: http://jsfiddle.net/P9awz/3/

This works as you want but the styles are not done.

Good luck.

Upvotes: 1

Related Questions