samedi 7 juin 2014

Ext.ux.form.field.QuickCombo

Now this may already have been made, or the config settings in 4.2.2 may allow it already - if so, then let me know please.

Because when I supplied a field definition by a "fields" config option, and data in a "data" config options - it did nothing for me.


So I give to you a (possibly olde) QuickCombo.


Takes normal config options, and unobtrusively lets you define a data and fields config option to bypass that pesky store implementation when all you want is a local quick and snappy combo.


Here is code



Code:



Ext.define('Ext.ux.form.field.QuickCombo', {
extend: 'Ext.form.field.ComboBox',
alias: 'widget.quickcombo',


/**
* @cfg {Array} data
* The data to put in the quickcombo
*/


/**
* @cfg {Array} fields
* The fields the store uses for data
*/


initComponent: function () {


var i_cmp = this,
i_store = i_cmp.createStore();


Ext.apply(i_cmp, {
store: i_store
});


i_cmp.callParent();


return i_cmp;
},


createStore: function () {


var i_cmp = this,
a_field = i_cmp.fields || [],
a_data = i_cmp.data || [],
i_store;


i_store = Ext.create('Ext.data.Store', {
fields: a_field,
data: a_data
});


return i_store;
}
});




Aucun commentaire:

Enregistrer un commentaire