PDA

View Full Version : Combobox listConfig selectedItemCls



mayoita
17 Sep 2012, 11:58 PM
Hi,
setting:

listConfig : { selectedItemCls: 'my-item-selected-class'
},
in ComboBox configuration doesn't work. Css class remain 'x-boundlist-selected'.
Why?

sword-it
18 Sep 2012, 1:34 AM
HI!

which version are you using of ExtJs 4?
also, you may check the API, default is x-item-selected not the boundlist-selected as mentioned by you...
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.view.BoundList

mayoita
18 Sep 2012, 3:53 AM
Hi sword-it,
I'm using ExtJs 4.0.1 but the problem is the same for 4.1.1.
Api documentation for Ext.view.BoundList said:

selectedItemCls (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.view.AbstractView-cfg-selectedItemCls) : String (http://docs.sencha.com/ext-js/4-1/#!/api/String)2
A CSS class to apply to each selected item in the view.
Defaults to: Ext.baseCSSPrefix + 'item-selected'
Available since: Ext 4

but in the Ext.view.BoundList (view source):
.
.
.initComponent: function() {

var me = this, baseCls = me.baseCls, itemCls = me.itemCls; me.selectedItemCls = baseCls + '-selected';where baseCls: Ext.baseCSSPrefix + 'boundlist',Infact my 'combobox' render:<ul>
<li class="x-boundlist-item x-boundlist-selected" role="option" id="ext-gen1153">iPhone</li>

<li id="ext-gen1152" class="x-boundlist-item" role="option">Home</li>

<li id="ext-gen1151" class="x-boundlist-item" role="option">Cell</li>

<li id="ext-gen1150" class="x-boundlist-item" role="option">Office</li>


</ul>
The problem is that other configuration works, like:listConfig: {
loadingHeight: 70,
minWidth: 70,
maxHeight: 300,
shadow: 'false',
selectedItemCls: Ext.baseCSSPrefix + 'item-selected-phone',
},
not selectedItemCls.

renato01
30 Jan 2013, 12:17 AM
This is an old thread, but I think its a bug.
Even in v4.2 still. The selectedItemCls is never set.

This works:



listConfig: {
itemCls: 'ux-check-combo-unselected',
listeners:{
afterrender:function(){
this.selectedItemCls = 'ux-check-combo-selected';
}
}
}