dcoan604
20 Feb 2012, 11:30 AM
Hi guys.
I have a typical border layout with menu in west region and content container in center.
I am using removeAll() and add() to swap panels in and out of the content container.
I have a controller which has refs set up to refer to one of the panels (ie ContactsPanel) that gets added to the content container.
Every panel that gets add()ed to the content container is set to autoDestroy = true.
Prior to add()ing a panel, it is first created using Ext.create (not xtype).
The FIRST time I add ContactsPanel to the content container, it is created using Ext.create... and my controller can correctly reference the panel (and its children) using the controllers getters. (ie getContactsPanel)
However, if I removeAll() and then later re- add() ContactsPanel... the following occurs:
1. ContactsPanel is created and displays in the content-container
2. the controller getter functions still return a reference to ContactsPanel using getContactsPanel()
3. But ContactsPanel is "destroyed"......ie getContactsPanel().isDestroyed== true
I have tried using Ext.create instead of xtype because I thought that would create a new instance of ContactsPanel. And I have even tried using Ext.create for all the children (items, dockedItems, etc) within ContactsPanel, and then adding them within ContactPanel.init() function.
My getters in the controller all work the first time ContactsPanel is added, but return references to destroyed objects when ContactsPanel is removed and re-added later.
Also, if I use getContactsPanel().query('textfield') to try to refer to textfields in my ContactsPanel it only works the first time. On subsequent 'adds' the query returns empty array []. I assume that is because the textfields were destroyed with my ContactsPanel.....
However, when I Ext.create the ContactsPanel, ContactsPanel.init() runs fine...and within this init I am using Ext.create to also create all of my textfields and add them ContactsPanel.items.
FYI: All of my controllers are setup using the application' controllers[] config.
Without switching to a card panel, what is the correct way to do this?
Thanks in advance.
I have a typical border layout with menu in west region and content container in center.
I am using removeAll() and add() to swap panels in and out of the content container.
I have a controller which has refs set up to refer to one of the panels (ie ContactsPanel) that gets added to the content container.
Every panel that gets add()ed to the content container is set to autoDestroy = true.
Prior to add()ing a panel, it is first created using Ext.create (not xtype).
The FIRST time I add ContactsPanel to the content container, it is created using Ext.create... and my controller can correctly reference the panel (and its children) using the controllers getters. (ie getContactsPanel)
However, if I removeAll() and then later re- add() ContactsPanel... the following occurs:
1. ContactsPanel is created and displays in the content-container
2. the controller getter functions still return a reference to ContactsPanel using getContactsPanel()
3. But ContactsPanel is "destroyed"......ie getContactsPanel().isDestroyed== true
I have tried using Ext.create instead of xtype because I thought that would create a new instance of ContactsPanel. And I have even tried using Ext.create for all the children (items, dockedItems, etc) within ContactsPanel, and then adding them within ContactPanel.init() function.
My getters in the controller all work the first time ContactsPanel is added, but return references to destroyed objects when ContactsPanel is removed and re-added later.
Also, if I use getContactsPanel().query('textfield') to try to refer to textfields in my ContactsPanel it only works the first time. On subsequent 'adds' the query returns empty array []. I assume that is because the textfields were destroyed with my ContactsPanel.....
However, when I Ext.create the ContactsPanel, ContactsPanel.init() runs fine...and within this init I am using Ext.create to also create all of my textfields and add them ContactsPanel.items.
FYI: All of my controllers are setup using the application' controllers[] config.
Without switching to a card panel, what is the correct way to do this?
Thanks in advance.