Question

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'
        }
    }
});
Was it helpful?

Solution

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

OTHER TIPS

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,
    ...
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top