1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    21
    Vote Rating
    1
    brian.scott@talgov.com is an unknown quantity at this point

      0  

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

    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

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,582
    Vote Rating
    433
    Answers
    3101
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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