Reputation: 6660
I have a FieldSet :
Ext.define('admin.view.BuzzEditForm', {
extend: 'Ext.form.Panel',
requires: ['Ext.form.FieldSet','Ext.Img'],
id: 'editorPanel',
xtype: 'buzzEditForm',
config: {
/* modal: true,
hideOnMaskTap: false,
centered: true,
width: 500,
scrollable: false,*/
items: [{
xtype: 'fieldset',
items: [
{
xtype: 'textfield',
name: 'keyword',
label: 'Mots clés'
},
{
xtype: 'textfield',
name: 'title',
label: 'Titre'
},
{
id: 'editorPanelvisual',
xtype: 'field',
label: 'Visuel actuel',
component:
{
xtype: 'container',
layout: 'hbox',
items: [
{
id: 'buzzImageField',
flex: 1,
xtype: 'image',
src: 'http://pierre.chachatelier.fr/programmation/images/mozodojo-original-image.jpg',
height: 200
},
{
id: 'buzzChooseImageField',
xtype: 'button',
iconCls: 'arrow_right',
iconMask: true,
ui: 'action',
action: 'chooseBuzzImage'
}
]
}
},
{
xtype: 'textfield',
name: 'visual',
label: 'Visuel'
}
]
}]
}
});
I can get my formPanel using Ext.getCmp('#editorPanel') but how can i get a field using its name?
Upvotes: 3
Views: 5804
Reputation: 2812
Just to mention that Ext.ComponentQuery.query('textfield[name="keyword"]')
returns an array. So if you need only one element like the example above, you will have to use .pop() function to get the last and the only element and then manipulate with it.
Upvotes: 0
Reputation: 6365
Just use Ext.ComponentQuery
, for example:
Ext.ComponentQuery.query('textfield[name="keyword"]')
For further details, please see this: http://docs.sencha.com/touch/2-0/#!/api/Ext.ComponentQuery
Upvotes: 4