xigwen
xigwen

Reputation: 1

Sencha-Touch: Uncaught TypeError: Cannot read property 'proxy' of undefined

I'm working with Sencha-Touch 1.1. I'm trying to store data/info that a user fills in a form. Sencha-touch-debug keeps sending this to my console:

    Uncaught TypeError: Cannot read property 'proxy' of undefined
    Ext.data.AbstractStore.Ext.extend.constructor                     sencha-touch-debug.js:6381
    Ext.data.Store.Ext.extend.constructor                             sencha-touch-debug.js          :6849
    (anonymous function)                                              form_stores.js:1

Nothing gets stored and I cant read any data. Json/localstorage all are not working. Do I have to call them in my Ext.regApplication?? I tried giving them ID but that didn't worked. I just cant figure out whats wrong.

Code from form_stores.js:

    App.stores.form = new Ext.data.Store({
        model: 'Form',
        autoLoad: true
    });

Code from form_model.js:

    App.models.Form = Ext.regModel('Form', {

        fields: [ .... ],
        validations: [ .... ],

        proxy: {
            type: 'localstorage',
            id: 'sencha-users'
        }
    });

Upvotes: 0

Views: 7066

Answers (2)

Tower He
Tower He

Reputation: 41

Import your models before the stores.

Upvotes: 1

Gaute Løken
Gaute Løken

Reputation: 7892

You're using the old way of registering your model. The sencha docs tells you the new way:

Ext.define("My.SpecifiedNamespace.Form", {
    extend: "Ext.data.Model", //The important bit

    fields: [ .... ],
    validations: [ .... ],

    proxy: {
        type: 'localstorage',
        id: 'sencha-users'
    }
});

Upvotes: 0

Related Questions