PDA

View Full Version : Where is the ref config option???



moacsjr
6 Sep 2011, 4:20 AM
:-?Where is the configuration option REF?
In Ext3 we can use the configuration option "ref" to easily get a reference component withouthaving to use Id's, but can not find this option in ext4. There is a better alternative to this feature in ext4?

mitchellsimoens
6 Sep 2011, 10:50 AM
ref config is not there in favor of the flexible ComponentQuery.

Take this form for an example...


var form = Ext.create('Ext.form.Panel', {
...
items : [
{
fieldLabel : 'Field 1'
},
{
fieldLabel : 'Field 2',
ref : 'getMe'
}
]
});

To get all fields, you can do this:


form.query('field');

or to get the first match:


form.down('field');

Now to get the one with the ref on it:


form.down('field[ref=getMe]');

skirtle
7 Sep 2011, 11:39 PM
Though I usually use component queries, itemId is another alternative.