1. #1
    Sencha User jesterxl's Avatar
    Join Date
    Feb 2012
    Location
    Atlanta, Georgia, USA
    Posts
    4
    Vote Rating
    0
    jesterxl is on a distinguished road

      0  

    Default Unanswered: Model doesn't have a "get" method

    Unanswered: Model doesn't have a "get" method


    The docs say a Model has a get method. However, I keep getting an undefined for mine.

    Code:
    Ext.define('GS.model.ConnectModel', {
        extend: 'Ext.data.Model',
    
    
        config: {
            fields: [
                {name: 'accessTokenKey',  type: 'string'},
                {name: 'accessTokenSecret',   type: 'string'}
            ],
            proxy: {
                type: 'localstorage',
                id  : 'soundcloud-key'
            }
        }
    });
    When I use it:

    Code:
    var store = Ext.create('Ext.data.Store', {
        model: 'GS.model.ConnectModel'
    });
    
    
    
    
    console.debug("store: " + store);
    console.debug("store.getModel: " + store.getModel);
    console.debug("store.load: " + store.load);
    var model = store.getModel();
    console.debug("model " + model);
    console.debug("model.get: " + model.get);
    I've tried the variant using the Model manager, instantiating directly, etc... all result in a model that has most of the methods the documentation states, ...but not get.

    I used the auto-gen project using the sencha tools so thought "maybe my SDK is just out of date". However, when I delete the whole directory, and replace with the "sencha-touch-2.0.0-commercial", it now complains about:

    Failed to load resource: the server responded with a status of 404 (Not Found)
    http://localhost/gs/GS/proxy/localstorage.js?_dc=1332710717654

    Confused...

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The class definition doesn't have the get method but the instance does. getModel() on the store returns the class definition, if you do store.getAt(0) that gets the first model instance int he store and that will have the get method.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1