PDA

View Full Version : [Solved]Scope Problems in form.Action.DirectLoad



drhelga
2 Dec 2009, 12:21 PM
Hi there,
maybe i'm just too dump to solve this, but I'm running out of ideas ...

i have extended a form panel like this:


Application.locationInfo = Ext.extend(Ext.form.FormPanel,{
title: 'Location Information',
border: false,
padding: 10,
defaultType: 'textfield',
defaults: {anchor: '100%'},
initComponent: function()
{
var config = {
items: [{
fieldLabel: 'Street',
name: 'street'
}],
api: {
load: Json.doLoad
},
buttons: [{
text: 'Load',
handler: function() {
this.load();
},
scope: this
}]

};
Ext.apply(this, Ext.apply(this.initialConfig, config));
Application.locationInfo.superclass.initComponent.apply(this, arguments);
},
onRender: function()
{
Application.locationInfo.superclass.onRender.apply(this, arguments);
this.load();
}
});
Ext.reg('locationInfo', Application.locationInfo);When putting this 'on stage' in the following code:


Ext.ns('Application');
Ext.onReady(function() {

Ext.QuickTips.init();

var accordion = new Ext.Panel({
layout: 'accordion',
renderTo: Ext.getBody(),
title: 'My Profile',
width: 300,
height: 240,
items: {xtype:'locationInfo'}
});
});I permanently get the error: this.processResponse is not a function

if i just spaghetti-code this stuff in one Ext.onReady function everything works fine.

I'm really going nuts with this,
i tried to set the scope at about 100.000.000 different places, i tried to set namespaces like the devil himself, but somehow i really really stuck ...
can someone please ease my mind?

drhelga
3 Dec 2009, 2:59 AM
Did not solve this exactly,
but i found that the scoping problems did exist in an extension of the original direct provider.
While using the standard one no prob's occur.

Andrulik
9 Feb 2010, 8:24 AM
Need your advice. When I'm using direct api action 'load' inside an extended form component, the form is loosing scope when loading, and I get the error message:

this.processResponse is not a function
and therefor formdata won’t be uploaded. Here is the form


AD.app.Update = Ext.extend(Ext.form.FormPanel, {
initComponent: function() {
Ext.apply(this, {
layout: 'anchor'
,frame: false
,border: false
,autoWidth: true
,autoHeight: true
,monitorValid: true
,resetAfterSubmit: true
,paramsAsHash: false
,items: [{
xtype: 'fieldset'
,items: [{
xtype: 'textfield'
,fieldLabel: 'element'
,name: 'id'
}]
}]
,buttonAlign:'center'
,buttons: [{
text: 'Load'
,scope: this
,handler: function() {
this.getForm().load({
waitMsg: 'Requesting...'
,scope: this
,params:{id: 123465}
,success: function() {
this.ownerCt.destroy();
}
,failure: function(form, action) {
Ext.Msg.alert('Load Failed!', 'Please come back later.');
}
});
}
},{
text: 'Cancel'
,scope: this
,handler: function(){
this.ownerCt.destroy();
}
}]
});
AD.app.Update.superclass.initComponent.call(this);
this.form.api = {
load: assets.load
,submit: assets.update
};
}
});
Ext.reg('form-update', AD.app.Update);IMO, it seems like the form is loosing scope. Or may be it something else? - scoping in extjs sounds like voodoo to me for now:">

Wolfgang
3 Apr 2010, 3:02 AM
I had a similar issue and found a solution here (http://www.extjs.com/forum/showthread.php?p=453847).