Results 1 to 2 of 2

Thread: Documentation Mix Up / Code Mix Up? -- Ext.data.Model.get(fieldName)

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    21
    Vote Rating
    1
      0  

    Default Unanswered: Documentation Mix Up / Code Mix Up? -- Ext.data.Model.get(fieldName)

    Hello friends -

    Here is my code:

    // OK. GET OUR STORE.
    var store = Ext.data.StoreManager.lookup('loginJsonStore');
    // GET ACCESS TO THE TEXT FIELD.
    var userNameTextBox = Ext.getCmp('userNameField');
    var passwordTextBox = Ext.getCmp('passwordField');
    store.getProxy().setExtraParams({userName:userNameTextBox.getValue(),
    password: passwordTextBox.getValue()});
    // SEE IF WE CAN GET SOMETHING.
    store.load();
    // LETS TRY TO POPULATE OUR VALUE.
    console.log("debug alpha");
    var loginModelRef = Ext.data.ModelManager.getModel('MyFirstTestApplication.model.loginModel');
    console.log(loginModelRef.prototype.fields);
    console.log("debug beta");
    var theModelField = loginModelRef.get("successOrFailureSw");
    console.log("debug gamma");
    console.log(theModelField);

    I am attaching a screenshot of the Chrome console, but the upshot is that I get success at server response time in regards that it gets my request based on the values that the user enters; but I get a failure at loginModelRef.get("successOrFailureSw") call. Specifically, it reads:

    Object function (){return this.constructor.apply(this,arguments)} has no method 'get'


    Curiously, the documentation set for Ext.data.Model states there is a get(fieldName) method.

    I'm almost certainly doing something wrong. What is it?

    Thanks.
    brian
    Attached Images Attached Images

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Answers
    3898
    Vote Rating
    1288
      0  

    Default

    You are doing it on a class but you need to do this on an instance...

    Code:
    var rec = store.getAt(1),
        value = rec.get('fieldname');
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

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