PDA

View Full Version : Need to handle load exception on panel.



CrazyEnigma
27 Nov 2009, 1:55 PM
I am performing an html load on a panel, using Panel.load(params) but there is no error handling or at least not from the documentation.

Am I missing something?

I load html from the server that threw an exception, and the panel just stays loading.

How can I handle the error?

Thanks in Advance.

CrazyEnigma
1 Dec 2009, 7:21 AM
callback is what I want, but is there documentation on what the object is returned. It states XHR or XMLHttpRequest, but I can't get status or readyState.

Mike Robinson
1 Dec 2009, 7:35 AM
Any "load()" request is, as you well know, asynchronous. Your call starts the ball rolling but does not wait for it to stop.

Sometime in the future, one of several callbacks will be made: for success, or for failure. There are several points in the process where callbacks can be trapped. For instance, failure can be conveniently trapped by Ext.data.Connection. ("Don't Repeat Yourself.")

CrazyEnigma
1 Dec 2009, 7:53 AM
@Mike: I kind of follow you, but don't.

In a regular Ext.ajax.request you can specify a success/failure property, but how can you do it for this:


listeners: {
afterrender: {
fn: function (o) {
o.load({
url: getData.php,
method: 'POST',
text: 'Loading Data...',
timeout: 30,
callback: function (response){
alert(response);
},
scope: o,
params: {
returnType: 'BuildingData'
}
});
}
},