I have a back end service that gives me an object which only contains an array of string. This is for example what the service gives me:
{
"DepartementsResult": [
"AME-CM",
"BMAU",
"BMKR",
"BNVS"
]
}
So to get this data I want to create a nice and simple store, but a first problem appear: what should be the field???
var store = Ext.create('Ext.data.Store', {
fields: ['data'], // What should be the fields here, I have none ^^"
pageSize: 0,
autoLoad: false,
proxy: {
type: 'ajax',
url: 'data.json', // this file contains the data described above
reader: {
type: 'json',
rootProperty: 'DepartementsResult'
}
}
});
And then when I want to create a combo using this store I don't know what I should write also:
var combo = Ext.create('Ext.form.field.ComboBox', {
store: store,
displayField: 'data', // what field should be displayed ^^" ?
valueField: 'data', // same here I don't really know what to write
fieldLabel: 'Departements',
renderTo: Ext.getBody()
});
Here is the link https://fiddle.sencha.com/#fiddle/iau to the sencha fiddle with the code described bellow ! Thanks a lot !!