Search code examples
buttonextjstextfieldref

ExtJs ref property


I have a code as below,

window = Ext.extend(Ext.Window, {
  initComponent: function(){
    Ext.applyIf(this,{
      fbar: {
        xtype: 'toolbar',
        items: [{
          xtype: 'button',
          id: 'button1',
          text: 'button1'
          ref: ??
        }
        ]
      },
      items:[{
        xtype: 'form',
        items: [{
          layout: 'form',
          items:[{
            xtype: 'field'
            id: 'field1'
            ref: ??
          }]
        }]
      }]
    })
  }
})

what can i have for ref property for field and button above, so that i can use with window variable? Please help me in this.

i tried with '../../button', but could not get access through window variable.


Solution

  • i figure it myself.

    the ref for button1 will be "../button" and ref for field will be "../../fieldname"... The window is invoked as,

    testWindow = new window();

    And the button1 can be accessed as, testWindow.button

    and the field as testWindow.fieldname