1. #1
    Sencha User
    Join Date
    Aug 2013
    Posts
    1
    Vote Rating
    0
    vjcortesa is on a distinguished road

      0  

    Default cannot pass the value of a variale to superclass.addOutput.apply

    cannot pass the value of a variale to superclass.addOutput.apply


    Dear all,
    Im trying to code in opengeo framework which uses ext js 3.4. I want to create a welcome button that has as text the username. I managed to assign the username value to the global variable: user = record[0].data.username. Then, I also assigned it to the text property: this.text.
    However when I tried to override the properties myapp.plugins.Welcome.superclass.addOutput.apply, neither the global variable user or the assignment to this.text is recognized. Any idea what might be wrong...When I put in console the value of this variables the username is shown just before the call to myapp.plugins.Welcome.superclass.addOutput.apply
    Thanks in advance for your help.
    /**
    *@require plugins/Tool.js
    *@require GeoExt/widgets/Action.js
    */
    Ext.ns("myapp.plugins");
    var user;
    myapp.plugins.Welcome = Ext.extend(gxp.plugins.Tool, {
    ptype: "myapp_welcome",
    store: null,
    //text: null,
    //auth: null,
    addOutput: function(config) {
    //var user = this.text;
    this.store = new Ext.data.JsonStore({
    // store configs
    //autoLoad: true,
    url: 'login_handle.php',
    storeId: 'myStore',
    // reader configs
    root: 'results',
    idProperty: 'username',
    baseParams: {task: "LOGIN"},// parameter pass to the php file
    fields: ['username','pwd', 'php_session'],
    success: function(response, action) {
    var text = response.responseText;
    }
    });
    this.store.load({
    callback : function(record, operation, success) {
    console.log(record);
    console.log(record[0].data.username);
    user = record[0].data.username;
    }
    });

    this.text = user;
    console.log(user);
    var out = myapp.plugins.Welcome.superclass.addOutput.apply(this, [{
    text: this.text,
    scope: this
    }]);
    return out;
    /*return myapp.plugins.Welcome.superclass.addOutput.call(this, Ext.apply({
    text: this.text
    }, config));*/
    }//addOutput
    });//myapp

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,971
    Vote Rating
    212
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Hmm... not sure. Just to make sure we're working from the lowest common denominator can you create a full test case using only ExtJS (including parent and subclass code)?
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

Thread Participants: 1

Tags for this Thread