PDA

View Full Version : [OPEN] mock data 404 not found



s0165
25 Aug 2015, 6:24 PM
Hi

I am confused that I created a JSON file in mock data and I tried to load the data to a store.
After I execute the code, the chrome developer tool tell me the file is 404 ( Not Found).
How do I load the JSON file correctly?
Thank you!


var comboStore = Ext.create('Ext.data.Store', {
fields: ['dimension', 'format'],
autoLoad: true,
proxy: {
type: 'ajax',
url: 'format',
actionMethods: {
create: 'POST',
read: 'POST',
update: 'POST',
destroy: 'POST'
},
reader: {
type: 'json',
root: 'formats'
}
}
});

var combo = Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose Format',
store: comboStore,
queryMode: 'local',
displayField: 'format',
valueField: 'local',
renderTo: Ext.getBody()
});


Fiddle (https://fiddle.sencha.com/#fiddle/srd)

mitchellsimoens
26 Aug 2015, 3:52 AM
Looks like the mock data overrides aren't hooking into 4.0.7 as if I select 4.2.1 it works.

WO_Jef
14 Jan 2016, 3:10 PM
I'm actually seeing this same error no matter the framework I use.

mitchellsimoens
15 Jan 2016, 4:27 AM
I'm actually seeing this same error no matter the framework I use.

It's working just fine for me. Here's a very simple fiddle I used:

13tl

I tested this on all these different versions:

Ext JS 6.0.1.250
Ext JS 6.0.0.640
Ext JS 5.1.2.748
Ext JS 5.1.1.451
Ext JS 5.1.0.107
Ext JS 5.0.1.1255
Ext JS 5.0.0.970
Ext JS 4.2.4.1720
Ext JS 4.2.3.1255
Ext JS 4.2.2.1144
Ext JS 4.2.1.883
Ext JS 4.2.0.663

Got tired of testing but then decided I need to test some Sencha Touch versions so used these:

Sencha Touch 2.4.2
Sencha Touch 2.4.1
Sencha Touch 2.4.0

And got tired of all these successes real quick.

WO_Jef
15 Jan 2016, 7:53 AM
That's so weird... take a look at this one (https://fiddle.sencha.com/#fiddle/13u2). store3 gets a 404. I had another example, but now I can't find it. Yours works just fine for me.

mitchellsimoens
15 Jan 2016, 7:57 AM
That's because you're creating and loading a store before Ext JS says it's ready which you should never do even in an application. Also, you are setting the store instances onto the class definition (not the class instance) which is also a no no.

WO_Jef
15 Jan 2016, 7:59 AM
Bitten by a rookie mistake again... I had started to move all my definitions outside of the Application, so I could use them as the viewport. Forgot I was actually creating stores there, then just got caught up in it. Duh. Thanks.