View Full Version : cannot pass the value of a variale to superclass.addOutput.apply

28 Dec 2013, 4:05 AM
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
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;
callback : function(record, operation, success) {
user = record[0].data.username;

this.text = 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));*/

13 Jan 2014, 12:55 PM
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)?