evant
28 May 2007, 12:03 AM
Code:
Linker = function()
{
this.dlg = null;
this.data = null;
this.addEvents({'complete': true});
Linker.superclass.constructor.call(this, {});
};
Ext.extend(Linker, Ext.util.Observable,
{
retrieve: function()
{
this.fireEvent('complete', this, this.data);
},
show: function()
{
//some code to create a dialog
this.dlg.addButton('Save', this.retrieve, this);
this.dlg.addButton('Close', this.dlg.hide, this);
//show dialog
}
}
);
When retrieve() is called after save is pressed, this.data always returns null because this is referring to the save button object (as opposed to the current instance). I think I'm not setting up the event handlers for the dialog correctly?
I've had a look at some of the Ext code and noticed that there doesn't seem to be any issue using this inside the class, so I've obviously screwed something up.
Your help would be appreciated.
Linker = function()
{
this.dlg = null;
this.data = null;
this.addEvents({'complete': true});
Linker.superclass.constructor.call(this, {});
};
Ext.extend(Linker, Ext.util.Observable,
{
retrieve: function()
{
this.fireEvent('complete', this, this.data);
},
show: function()
{
//some code to create a dialog
this.dlg.addButton('Save', this.retrieve, this);
this.dlg.addButton('Close', this.dlg.hide, this);
//show dialog
}
}
);
When retrieve() is called after save is pressed, this.data always returns null because this is referring to the save button object (as opposed to the current instance). I think I'm not setting up the event handlers for the dialog correctly?
I've had a look at some of the Ext code and noticed that there doesn't seem to be any issue using this inside the class, so I've obviously screwed something up.
Your help would be appreciated.