开发者

ExtJS 4 Set object dom ID in form panel

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]')

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜