Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Icon In ExtJs Combo

Tags:

extjs

How to display Icon along with display field in ExtJs Combo.Is There any extension for extjs combo. Please provide some samples.

like image 204
MNR Avatar asked May 24 '11 07:05

MNR


3 Answers

For ExtJS4 add a listConfig with getInnerTpl Method to the combobox:

xtype: 'combobox',
anchor: '100%',
listConfig: {
  getInnerTpl: function(displayField) {
    return '<img src="/images/icons/{id}.png" class="icon"/> {' + displayField + '}';
  }
},
name: 'type',
fieldLabel: 'Group Type',
displayField: 'label',
hiddenName: 'type',
queryMode: 'local',
store: 'group.Types',
valueField: 'id'
like image 63
Thomas Lauria Avatar answered Nov 16 '22 00:11

Thomas Lauria


Refer this :

Workaround-Image-in-Combobox-options

Country selector with flag images in ExtJS

like image 31
MMT Avatar answered Nov 16 '22 00:11

MMT


Another way, I think is possible to improve it but works ok for me:

  ,store: new Ext.data.ArrayStore({
              id: 0,
              fields: [
                'lang', 'desc','url'
             ],
             data: [['CA','Spanish','es.gif'],['VA','Valencian','va.gif']]
 })

 ,tpl : '<tpl for=".">'+
                 '<tpl if="0==0"><div class="x-combo-list-item" ><img src="../img/{url}">       {desc}</div></tpl>'+
                '</tpl>'
like image 1
Gustavo Avatar answered Nov 16 '22 00:11

Gustavo