0

persomview is the ID of View class. part of its definition is as follows;

Ext.define('ProjPerson.view.person.PersonTab' ,{
    extend:'Ext.tab.Panel',
    alias : 'widget.ptab',
    id:'ptabid', ......

Now from another view classes Controller method, i am calling the PersonTab to be displayed by using the following code;

var form = Ext.getCmp('ptabid');
form.show();

then in firebug it says form is not defined. How can i solve this ?

sha
  • 17,824
  • 5
  • 63
  • 98
Sharon Watinsan
  • 9,620
  • 31
  • 96
  • 140
  • `Ext.getCmp()` looks for a component instance. Just defining a class doesn't mean `Ext.getCmp()` will find it. Is your view class rendered? – Izhaki Jul 04 '12 at 14:45
  • I am able to `form.hide()`, but not `show.show()`. If i could do this, it would be great – Sharon Watinsan Jul 04 '12 at 14:52

1 Answers1

1

define itemId and use it with getCmp

itemId:'ptabid',

An itemId can be used as an alternative way to get a reference to a component when no object reference is available. http://docs.sencha.com/ext-js/4-1/#!/api/Ext.tab.Panel-cfg-itemId

if you want to find active tab, you can use

Ext.getCmp('center-region').getActiveTab()

here 'center-region' is from layout. use appropriate layout region which you use there.

Jom
  • 1,877
  • 5
  • 29
  • 46