Ext.create('Ext.form.FormPanel', {
title: 'Task option',
items:[
{
xtype: 'textfield',
name: 'txt-test1',
id: 'time',
How can i retrive this objec开发者_StackOverflow中文版t? id: 'time' not assign to element id.
Ext provides a straightforward means of accessing component objects by ID:
Ext.getCmp('time')
Also see the new component query : http://dev.sencha.com/deploy/ext-4.0-beta2/docs/api/Ext.ComponentQuery.html
You can then select the component via the "#id" selector.
There is also the possibility to find query in a components tree with cmp.query, cmp.down...
Assuming the following :-
Ext.create('Ext.form.FormPanel', {
**alias:'myFormPanel'**
title: 'Task option',
items:[
{
xtype: 'textfield',
name: 'txt-test1',
id: 'time',
you can use :- Ext.ComponentQuery.query('myFormPanel textfield[name=txt-test1]')
精彩评论