I am looking for a way to access components / field that are either in the same items array as the accessing one or even only in a same parent items array (the last one is j
Here are some tricks I have used:
//lookup by name
formPanel.getForm().findField('state');
//lookup using nextSibling/prevSibling in a fieldset or fieldcontainer
myField.ownerCt.nextSibling('textfield[fieldLabel=Description]')
Here fieldLabel
property is used to narrow down field selection but you can use ANY property at all. So if you construct a field with a property ref
you can then use it to select your field similar how you would use it in a ComponentQuery
.
Alternately, for your case of getting the next element in a container, you can use the nextSibling
or prevSibling
. All components have these methods. It would be a little less walking around the DOM structure. They also allow for a selector argument.
They are described in the docs here.