Kein
Kein

Reputation: 996

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 object? id: 'time' not assign to element id.

Upvotes: 1

Views: 3048

Answers (3)

redzedi
redzedi

Reputation: 1995

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

Upvotes: 1

Drasill
Drasill

Reputation: 4016

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...

Upvotes: 1

Jollymorphic
Jollymorphic

Reputation: 3530

Ext provides a straightforward means of accessing component objects by ID:

Ext.getCmp('time')

Upvotes: 1

Related Questions