PDA

View Full Version : [OPEN] [FIXED-EXTJSIV-2519] When creating a store, fails silently if model doesn't exist.



dogomatic
17 May 2011, 12:13 PM
I was doing this in an MVC app:



return Ext.create('Ext.data.Store', {
autoLoad: true,
model: 'MyModel',
proxy: {
type: 'ajax',
url : myurl,
reader: {
type: 'json',
root: 'mymodels'
}
}
});

and getting an error from reader.read being undefined in data/Server.js:223

Turns out it was because I should have used the full path of the model (MyApp.model.MyModel). Consistency of use for full path vs class name only is another issue, but what I think could be improved is having it fail loudly when Ext.ModelManager.getModel returns undefined (at least in this context). This would help catch typos too.

Otherwise you have to trace back from the error you got to where it actually went wrong.

evant
14 Jun 2011, 4:47 PM
I've added a warning that will show in debug mode if you try and create a store with a model (implicit or explicit).

SebTardif
14 Jun 2011, 6:41 PM
Thanks for the warning. If Sencha developers get used to improve diagnostic for each error investigated, the learning curve will be lower.