0
votes

I want to apply a plugin to all fields(numberfield, textfield, datefield, etc.) in the library ExtJS 4.1. Is there anyone who knows how can I do this?

As I know, all fields are extended from BaseField. So I tried this; but it didn't work at all. I'll be happy if someone can guide me.

Thanks in advance.

Ext.form.BaseField.override({
     plugins    : [ 'clearbutton' ]
}); 
2
This is an invalid question since it doesn't make sense to override all fields with the clearbutton extension. Certain form fields in Extjs 4.1 are not compatible with clearbutton. - Reimius

2 Answers

0
votes

Maybe this syntax will work better?

Ext.override(Ext.form.field.Base, {
   plugins    : [ 'clearbutton' ]
});
0
votes

Try to override initComponent method :

Ext.form.BaseField.override({
 initComponent : function(){
   var me = this;
   me.plugins = Ext.Array.merge(me.plugins || [],  [ 'clearbutton' ]);
   me.callParent();
 }
});