change the "ready" event to "connected" and fix the failure event

handler
This commit is contained in:
Damien Churchill 2009-04-27 12:55:42 +00:00
parent a9392f9002
commit c4cdd70a4e
1 changed files with 14 additions and 9 deletions

View File

@ -43,11 +43,11 @@ Ext.namespace('Ext.ux.util');
this.addEvents( this.addEvents(
// raw events // raw events
/** /**
* @event ready * @event connected
* Fires when the client has retrieved the list of methods from the server. * Fires when the client has retrieved the list of methods from the server.
* @param {Ext.ux.util.RpcClient} this * @param {Ext.ux.util.RpcClient} this
*/ */
'ready' 'connected'
); );
this.reloadMethods(); this.reloadMethods();
}, },
@ -85,14 +85,19 @@ Ext.namespace('Ext.ux.util');
}); });
}, },
_onFailure: function(response, options) { _onFailure: function(response, requestOptions) {
if (response.status == 500) { var options = requestOptions.options;
//error
}
errorObj = { errorObj = {
id: options.options.id id: options.id,
result: null,
error: 'HTTP' + response.status
}
if (Ext.type(options.failure) != 'function') return;
if (options.scope) {
options.failure.call(options.scope, responseObj.error, responseObj, response);
} else {
options.failure(responseObj.error, responseObj, response);
} }
//alert(Ext.encode(errorObj));
}, },
_onSuccess: function(response, requestOptions) { _onSuccess: function(response, requestOptions) {
@ -161,7 +166,7 @@ Ext.namespace('Ext.ux.util');
} }
this._components = Ext.keys(components); this._components = Ext.keys(components);
this.fireEvent('ready', this); this.fireEvent('connected', this);
} }
}); });
})(); })();