我有一个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'
}
]
}]
}
});我可以使用Ext.getCmp('#editorPanel')获取我的formPanel,但是如何使用字段的名称获取字段呢?
发布于 2012-05-15 23:07:06
只需使用Ext.ComponentQuery,例如:
Ext.ComponentQuery.query('textfield[name="keyword"]')
欲了解更多详情,请访问:http://docs.sencha.com/touch/2-0/#!/api/Ext.ComponentQuery
发布于 2012-12-11 22:38:52
顺便提一下,Ext.ComponentQuery.query('textfield[name="keyword"]')返回一个数组。因此,如果您只需要一个类似上面示例的元素,则必须使用.pop()函数来获取最后一个也是唯一一个元素,然后对其进行操作。
https://stackoverflow.com/questions/10603594
复制相似问题