PDA

View Full Version : upgrading array store on combo box from 4.07 to 4.1



Anthony.Hall
10 May 2012, 8:13 AM
The below configuration works on 4.07 but not 4.1.

On 4.1 i can see that my combo has 3 items. It just doesn't reader the displayField and valueField.

i'm using the mvc architecture.

In my view


{ xtype: 'combobox',
id: 'ProofRequired',
name: 'ProofRequired',
fieldLabel: 'Proof Required',
displayField: 'Name',
store: 'ProofRequired',
triggerAction: 'all',
queryMode: 'local',
valueField: 'Id'


},

in my app.js



stores: [ 'VarnishType'],


my store


Ext.define('Mis.store.ProofRequired', { extend: 'Ext.data.Store',


constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
storeId: 'ProofRequired',
clearOnPageLoad: false,
data: [
{
Id: '1',
Name: 'Digital'
},
{
Id : '2',
Name : 'PDF'
},
{
Id : '3',
Name : 'Other'
}
],
proxy: {
type: 'ajax',
reader: {
type: 'array'
}
},
fields: [
{
Id: 'Id',
Name: 'Name'
}
]
}, cfg)]);
}
});

skirtle
11 May 2012, 6:34 AM
Your fields config looks amiss. It should probably be this:


fields: ['Id', 'Name']

Inline data doesn't pass through the reader, your whole proxy will be ignored. If you want to swap from inline data to loading data via Ajax that's a different story, but without seeing your server response it's a little difficult to speculate what the correct reader and field configuration should be.