Reputation: 4281
I am trying to create a fidlle where data will load from json. But I don't know why data is not loading.
Here is my fiddle Fiddle
Here is my data store code
Ext.create('Ext.data.Store', {
storeId: 'Ajax_Store',
proxy: {
type: 'ajax',
url : 'emp.json',
reader: {
type: 'json',
rootProperty:"Emp"
}
},
autoLoad : true,
fields: ['E_ID','E_FName','E_LName','E_Place']
});
Upvotes: 0
Views: 36
Reputation: 20224
It is because you have enabled "dynamic data" but not returned anything from the function body:
If you disable dynamic data, you will find that JSON does only use double quotes. Corrected JSON file:
{"Emp" : [{
"E_ID": 125,
"E_FName": "lisa",
"E_LName":"King",
"E_Place": "Rome"
},
{
"E_ID": 126,
"E_FName": "John",
"E_LName":"Lever",
"E_Place": "Rome"
},
{
"E_ID": 127,
"E_FName": "Lee",
"E_LName":"Dev",
"E_Place": "Rome"
}
]}
This will load correctly if "dynamic data" option is disabled.
Upvotes: 1