Ext.define('phpdoe.view.form.IconCombo', {
extend:'Ext.form.ComboBox',
alias:'widget.iconcombo',
initComponent:function () {
Ext.apply(this, {
listConfig:{
iconClsField:this.iconClsField,
tpl:'
' +
'- ' +
'' +
'{name}' +
'
' +
'
'
}
});
// call parent initComponent
this.callParent(arguments);
}, // end of function initComponent
onRender:function (ct, position) {
var temp;
this.callParent(arguments);
this.inputEl.applyStyles({'padding-left':'25px'});
this.inputEl.wrap('');
this.icon = Ext.DomHelper.insertBefore(this.inputEl, '');
},
setIconCls:function () {
if (this.rendered) {
var rec = this.store.findRecord(this.valueField, this.getValue());
if (rec) this.icon.className = rec.get(this.iconClsField);
} else {
this.on('render', this.setIconCls, this, { single:true });
}
},
setValue:function (value) {
this.callParent(arguments);
this.setIconCls();
}
});