This one doesnt work.
Code:var components = this.findByType(Ext.form.Field, true); for (var j = 0; j < components.length; j++) { components[j].disable(); }
This one doesnt work.
Code:var components = this.findByType(Ext.form.Field, true); for (var j = 0; j < components.length; j++) { components[j].disable(); }
Last edited by madkris; 18 Jul 2010 at 10:11 PM. Reason: resolved
Forgot to mention that I tried that too. Doesn't seem to work or maybe I misunderstood the docs?
shallow : Boolean
(optional) False to check whether this Component is descended from the xtype (this is the default), or true to check whether this Component is directly of the specified xtype.
You set the second parameter to true. So, according to the documentation you are looking for components that are field xtyped (not descended xtypes). Now the title of the thread specify that you are extending Ext.form.Field if I'm right.
Code:var components = this.findByType('field'); for (var j = 0; j < components.length; j++) { components[j].disable(); }
findByType works. It just does.
You are sure what "this" is when that runs? Because you have debugged BY STEPPING THROUGH CODE haven't you?
@tomtom - Thanks, for the explanation! Actually I wasn't Extending Ext.form.Field, Ext JS already did that for me.
@Animal - Yes, of course. Sorry I missed that you omitted the second parameter.
Might not be worth posting but it might help someone.
From:
To:Code:var types = ['textfield', 'radio', 'radiogroup']; for (var i = 0; i < types.length; i++) { var components = this.findByType(types[i], true); for (var j = 0; j < components.length; j++) { components[j].enable(); } }
Code:var components = this.findByType('field'); for (var j = 0; j < components.length; j++) { components[j].enable(); }