View Full Version : Ajax proxy fiddle doesn't load relative path simpsons.json file -- why not?

20 Sep 2017, 6:07 AM
Fiddle example: https://fiddle.sencha.com/#view/editor&fiddle/2700

Creating the most simple of examples that I could conjure, I'm not seeing the reason why this fiddle won't load the relatively referenced Simpsons.json file.

• Code taken directly from the first fiddle of this doc page:

• And then referring to the fiddle doc:

Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['name', 'email', 'phone'],
proxy: {
type: 'ajax',
url: 'Data/Simpsons.json',
reader: 'json'
// • Moved following data into: Data/Simpsons.json
// • converted data to valid json w/ double quotes
// data: [{
// name: 'Lisa',
// email: 'lisa@simpsons.com',
// phone: '555-111-1224'
// }, {
// name: 'Bart',
// email: 'bart@simpsons.com',
// phone: '555-222-1234'
// }, {
// name: 'Homer',
// email: 'homer@simpsons.com',
// phone: '555-222-1244'
// }, {
// name: 'Marge',
// email: 'marge@simpsons.com',
// phone: '555-222-1254'
// }]

Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email',
flex: 1
}, {
text: 'Phone',
dataIndex: 'phone'
height: 200,
width: 400,
renderTo: Ext.getBody()

20 Sep 2017, 6:10 AM
Two reasons:

1) The path shouldn't have 'Data/' in it, that is just a tree node describing it's children just like Assets and Packages
2) You aren't telling your store to load. You can add autoLoad: true to your store to make it load when it's instantiated

20 Sep 2017, 6:27 AM
BAM! That was quick.

I still don't understand how it knows to look in the Data directory for the json file. Is that something setup in the fiddle context?

20 Sep 2017, 6:29 AM
Yes, that is a fiddle thing. When fiddle 1 was around, it didn't make live network calls for anything so having them split made sense for the ajax requests and since there were over 50,000 fiddles and fiddle 2 can work in a fiddle 1 way (so it doesn't break old fiddles) it has to be kept separate. In a new fiddle, you can assume the Assets and Data are merged into one file system.

20 Sep 2017, 6:39 AM
Thanks Mitchell!