Ext.create('Ext.form.FormPanel', {
title: 'Task option',
items:[
{
xtype: 'textfield',
name: 'txt-test1',
id: 'time',
如何检索此对象? id:'time'未分配给元素id。
答案 0 :(得分:1)
Ext提供了一种通过ID访问组件对象的简单方法:
Ext.getCmp('time')
答案 1 :(得分:1)
另请参阅新组件查询:http://dev.sencha.com/deploy/ext-4.0-beta2/docs/api/Ext.ComponentQuery.html
然后,您可以通过“#id”选择器选择组件。
还可以使用cmp.query,cmp.down ...在组件树中查找查询。
答案 2 :(得分:1)
假设如下: -
Ext.create('Ext.form.FormPanel', {
**alias:'myFormPanel'**
title: 'Task option',
items:[
{
xtype: 'textfield',
name: 'txt-test1',
id: 'time',
你可以使用: - Ext.ComponentQuery.query('myFormPanel textfield [name = txt-test1]')