Results 1 to 2 of 2

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

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

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •