PDA

View Full Version : jQuery developer -> ExtJS: How to select multiple elements then do something to each



igaenssley
23 Sep 2010, 9:18 AM
Hey guys,
I haven't had a ton of experience with the DOM using ExtJS, I'm very familiar with jQuery. I know this is possible, I'm obviously just missing what ExtJS calls this, but I want to do something like the following:

1. I have a fieldset with an id of 'fieldset1'
2. There are 10 textfields withing this fieldset.
3. I am using a toggle control outside of this fieldset which I want to enable or disable each field.

Why am I not just calling disable on the fieldset itself? Because I don't want it to gray out the entire fieldset, I need it readable and clean. In face, I have custom CSS that takes the border and background off the field when disabled, and returns it when enabled.

So, in jQuery I'd just do this:
$('input','#fieldset1').each(function(){
$(this).someMethodThatHandlesDisabling();
});

How do I do this in ExtJS?
I've seen Ext.query(), but how do I work with each element it returned?

darthwes
23 Sep 2010, 9:40 AM
var x = Ext.getCmp('fieldset1');
x.items.each(someMethodThatHandlesDisabling);

Animal
23 Sep 2010, 10:18 AM
Ext.select("#fieldset input").methodOfExt.Element


eg



Ext.select("#fieldset input").set({disabled: true})