Reputation: 6466
I'm getting an error like I added below while using static data with memory proxy. Can someone show me my mistake or missing part?
Thanks in advance.
me.model is undefined
me.setProxy(me.proxy || me.model.getProxy());
My model definition:
Ext.define(appName + '.model.Country', { extend: 'Ext.data.Model',
fields: [
{type: 'string', name: 'abbr'},
{type: 'string', name: 'name'},
{type: 'string', name: 'slogan'}
]
});
And here's my store definition:
// The data for all states
var data = {
states : [
{'abbr':'AL','name':'Alabama','slogan':'The Heart of Dixie'},
{'abbr':'AK','name':'Alaska','slogan':'The Land of the Midnight Sun'}
]
};
Ext.define(appName + '.store.Countries', {
extend : 'Ext.data.Store',
model : appName + '.model.Country',
data : data,
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'states'
}
}
});
Upvotes: 0
Views: 1538
Reputation: 528
You might want to check if the model file is actually loaded and available for usage. When dealing with a large number of files, ExtJS (I have encountered this while working with 4.2.1) has problems with ordering them.
A quick fix is using requires: in the application definition:
Ext.application({
name: 'APP',
appFolder: 'application',
controllers: [
...
],
requires: ['APP.model.examples', 'APP.model.other' ...],
...
});
If this helps, I have written more on a PHP solution here:
Solution for ExtJS 4 me.model is undefined error
Upvotes: 1
Reputation: 740
Did you try to create the store explicitly and specify it in the config of the container?
For example:
var store = Ext.create(appName + '.store.Countries');
Ext.create('Your Component', {
...
store: store,
...
});
Upvotes: 0