Is there a way to configure ExtJS (through an Ext.override?) so that submitEmptyText config option for Ext.form.Action.Submit is false by default instead of true?
I know it's possible to override methods on classes but i don't know about default config properties, one might think that since config options are mostly public properties that console logging Ext.form.Action.Submit.submitEmptyText would output false but it is undefined.
One way I succeeded is by creating an interceptor for the run method but that basically renders the submitEmptyText config option useless since it can't be set anymore through a config object passed to the constructor.
Ext.form.Action.Submit.prototype.run = Ext.form.Action.Submit.prototype.run.createInterceptor(function() {
this.options.submitEmptyText = false;
});
[Edited a few times, but this works for me]
submitEmptyText is not actually a property of the Ext.form.Action.Submit prototype -- it is just checked in the run function as a property of the "this.options" object -- which itself is defined on the superclass, Ext.form.Action
If you want it to be globally false by default, then just set it on the options property of Ext.form.Action after it is constructed
Ext.form.Action.prototype.constructor = Ext.form.Action.prototype.constructor.createSequence(function() {
Ext.applyIf(this.options, {
submitEmptyText:false
});
});
It's tricky, because the Ext.form.Action sets this.options to an empty object in its constructor, so you have to get access to that options property after the constructor executes, which is why a createSequence works in this case.
If you want to override the Ext.form.Action.submit() for all instances then why not just use an Ext.override?
Ext.override(Ext.form.Action.submit, {
submitEmptyText: false
});
If you want the submitEmptyText from Ext.form.Action.submit to be false, just set it in the config when you create the Ext.form.Action.submit object.
var submit = Ext.form.Action.submit({
submitEmptyText: false
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With