PDA

View Full Version : Help, I can't destroy my fullscreen TabPanel



goangus
10 Jan 2012, 6:00 AM
Hi there,

I am trying to call the destroy() method but it returns the error:


Cannot call method 'createChild' of undefined

The two Tab Panels work fine when loaded initially, everything is good apart from when I try to destroy the current and load a new one. I would very much appreciate an idea of what I might be doing wrong.



My App:

pp = new Ext.Application({
name: "App",
launch: function() {
this.views.viewport = (Ext.is.Desktop || Ext.Viewport.getOrientation() == 'portrait') ? new this.views.ViewportActive : new this.views.ViewportGraph;
}


My Component:

App.views.ViewportActive = Ext.extend(Ext.TabPanel, { id: "mainViewport",
fullscreen: true,
monitorOrientation: true,
listeners: {
orientationchange: function(){
App.views.viewport.destroy();
App.views.viewport = (Ext.Viewport.getOrientation()=='landscape' && !Ext.is.Desktop) ? new App.views.ViewportGraph : new App.views.ViewportActive;

}
}

This is the trace:



Uncaught TypeError: Cannot call method 'createChild' of undefined

Ext.layout.BoxLayout.Ext.extend.getTargetsencha-touch-debug.js:29962 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.layout.Layout.Ext.extend.destroysencha-touch-debug.js:28960 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.apply.destroysencha-touch-debug.js:443 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.beforeDestroysencha-touch-debug.js:21042 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.doRemovesencha-touch-debug.js:21522 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.beforeDestroysencha-touch-debug.js:20074 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.doRemovesencha-touch-debug.js:20934 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.beforeDestroysencha-touch-debug.js:21038 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Panel.Ext.extend.beforeDestroysencha-touch-debug.js:21522 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Component.Ext.extend.destroysencha-touch-debug.js:20074 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.doRemovesencha-touch-debug.js:20934 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.beforeDestroysencha-touch-debug.js:21038 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Panel.Ext.extend.beforeDestroysencha-touch-debug.js:21522 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Component.Ext.extend.destroysencha-touch-debug.js:20074 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.doRemovesencha-touch-debug.js:20934 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.beforeDestroysencha-touch-debug.js:21038 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Panel.Ext.extend.beforeDestroysencha-touch-debug.js:21522 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Component.Ext.extend.destroysencha-touch-debug.js:20074 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.doRemovesencha-touch-debug.js:20934 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.beforeDestroysencha-touch-debug.js:21038 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Panel.Ext.extend.beforeDestroysencha-touch-debug.js:21522 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Component.Ext.extend.destroysencha-touch-debug.js:20074 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.doRemovesencha-touch-debug.js:20934 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Container.Ext.extend.beforeDestroysencha-touch-debug.js:21038 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Panel.Ext.extend.beforeDestroysencha-touch-debug.js:21522 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
Ext.lib.Component.Ext.extend.destroysencha-touch-debug.js:20074 (http://dev.weighttracker.lighterlife.mobi/lib/sencha-touch-1.1.0/sencha-touch-debug.js)
App.views.ViewportActive.Ext.extend.listeners.orientationchange

mitchellsimoens
10 Jan 2012, 6:04 AM
You are destroying and then recreating the same view on orientation change?

goangus
10 Jan 2012, 6:12 AM
Sort of, I have two seperate Tabpanels: ViewportActive and ViewportGraph. I need to show ViewportActive when in portrait mode and ViewportGraph when in Landscape.

mitchellsimoens
10 Jan 2012, 6:44 AM
Just looking at this thread, I would say destroy happened when it was relaying out the tabpanel.

goangus
10 Jan 2012, 7:39 AM
It's sorted now. The component causing the problem was a FormPanel in the viewportActive Panel. I removed the FormPanel from the rendered items and the destroy worked again. Thanks for your help.