PDA

View Full Version : Can I apply pre-configured configs to an existing Ext class?



ang89
21 Aug 2009, 7:47 PM
I want to apply a default success and failure handling to Action.Submit class. Can I do it?

22 Aug 2009, 7:13 AM
Ext.form.Action.Submit.prototype.success = function(response) {}

ang89
23 Aug 2009, 6:47 PM
Ext.form.Action.Submit.prototype.success = function(response) {}

Hi, thanks for the reply.

I've tried to use
Ext.form.Action.Submit.prototype.failure = function (form, action) { // Do something } but it doesn't work. I tried to look at the source code, and from what I found, this failure is not stored as a property (hence, overiding prototype doesn't work, am I right?). Is there any alternative to define my default failure handling mechanism?

ang89
23 Aug 2009, 7:27 PM
Ah, It's okay now. I'm using something like:

var failure_handling = function (form, action) {};
new Ext.form.Action.Submit({ failure: failure_handling });
Why haven't I thought about this before :p

Thanks, anyway.