I have this JSON store but it`s not coded correctly. What is the correct syntax for it?
Ext.define(\'MA.store.Language\', {
extend : \'Ext.data.Store\',
fiel
Firstly, in your combobox configuration you must have: store : Ext.create('MA.store.Language'), instead of: store : 'Language',
And secondly, your store definition must look like this:
And it will work as you expect with your combobox.
Ext.define('MA.store.Language', {
extend : 'Ext.data.Store',
fields : [ {
name : 'id'
}, {
name : 'name'
} ],
data : [ {
"aa" : "Afar",
"ab" : "Abkhazian",
"ace" : "Achinese",
"ach" : "Acoli",
"ada" : "Adangme",
"ady" : "Adyghe",
"ae" : "Avestan",
"af" : "Afrikaans",
"afa" : "Afro-Asiatic Language",
"afh" : "Afrihili",
"ain" : "Ainu",
"ak" : "Akan"
} ],
read : function() {
var me = this;
var oldData = me.getProxy().data[0];
var data = [];
for (var prop in oldData) {
if (oldData.hasOwnProperty(prop)) {
data.push({
id: prop,
name: oldData[prop]
});
}
}
me.loadData(data);
}
});
EDIT: instead of this:
I had this:
data.push({
id: prop,
name: oldData[prop]
});
data.push({
id: prop,
value: oldData[prop]
});