David David - 25 days ago 6
Javascript Question

Data is not loading for grid from JSON

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',
autoLoad : true,
fields: ['E_ID','E_FName','E_LName','E_Place']

Answer Source

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_Place": "Rome"
   "E_ID": 126,
   "E_FName": "John",
   "E_Place": "Rome"
   "E_ID": 127,
   "E_FName": "Lee",
   "E_Place": "Rome"

This will load correctly if "dynamic data" option is disabled.