PDA

View Full Version : Using itemId & getComponent in a nested layout



joevelardi
10 Oct 2013, 8:48 PM
Hi, moving away from Ext.getCmp to using getComponent.

Have read the forums and API docs but haven't been able to obtain the nested object.



var fsFrequency = new Ext.form.FieldSet({
title: 'Frequency',
defaults: { hideLabel: true, disabled: true },
items: [ { itemId: 'cbxFrequencies',
xtype: 'checkboxgroup',
columns: 3,
items: [ { itemId: 'freqWeekly',
boxLabel: 'Weekly'
},{ itemId: 'freqMonthly',
boxLabel: 'Monthly'
},{ itemId: 'freqQuarterly',
boxLabel: 'Quarterly'
} ]
} ]
});


i have used the following to access the child object;


fsFrequency.getComponent('cbxFrequencies').disable();


... but how do i access `freqWeekly` ..

Joe

israelroldan
14 Oct 2013, 1:33 PM
Since checkboxgroup is not a container, the only way to access its items would be like this:

fsFrequency.getComponent('cbxFrequencies').items
Per the docs, getComponent returns a Component, which is the case of checkboxgroup.

joevelardi
17 Oct 2013, 1:12 PM
Thanks Israel, this has worked fine.

In cases where i am nesting container components, what is the best method to attain these nested child components ?

Joe

israelroldan
17 Oct 2013, 1:19 PM
You can use getComponent() on any container just like you're doing to retrieve cbxFrequencies.