Это метод удаления стандартного текстового поля из Ext.Msg и последующего добавления пользовательского компонента.
Ext.define('ComboBoxPrompt', {
extend: 'Ext.window.MessageBox',
initComponent: function () {
this.callParent();
var index = this.promptContainer.items.indexOf(this.textField);
this.promptContainer.remove(this.textField); // remove standard prompt
this.textField = this._createComboBoxField();
this.promptContainer.insert(index, this.textField);
},
_createComboBoxField: function () {
//copy paste what is being done in the initComonent to create the combobox
return Ext.create('Ext.form.field.ComboBox', {
id: this.id + '-combo',
typeAhead: true,
displayField: 'value',
valueField: 'id',
store: someStore,
mode: 'remote', // local
triggerAction: 'all',
forceSelection: true,
autoSelect: false,
hideTrigger: true,
minChars: 1,
enableKeyEvents: true,
listeners: {
change: function (obj, newValue, oldValue, eOpts) {
//someStore.proxy.extraParams.keyword = newValue;
//someStore.load();
}
} // listeners
});
}
});
var msgbox = Ext.create('ComboBoxPrompt').prompt('New Record', 'Object Name',
function (btn, text) {
if (btn == 'ok') {
Ext.MessageBox.alert('Result', text);
}
})