I am try to write method which set readOnly property for all fields on the form.
My code:
Ext.override(Ext.form.Panel,{
setReadOnlyForAll: function(bReadOnly) {
this.cascade(function(f) {
if (f.isFormField) {
f.setReadOnly(bReadOnly);
}
});
});
Invoke this method from Ext.form.Panel:
this.setReadOnlyForAll(false);
But this method work so slowly.Have somebody an idea how to increase speed? Thank you!
cascadechecks every child of the current container (such as anExt.form.Panel) and this means you’ve to check if the current child is a form field or not.So, use
Ext.form.Basic.getFieldsmethod to get every form fields:Further more, I suggest you to use
Ext.defineinstead ofExt.override.