PDA

View Full Version : recreating panels and isValidParent function



Champi
22 Sep 2011, 2:39 PM
Hi,

When creating a Panel that has been formerly removed, sencha throws : Uncaught Type error : cannot read property parent node of undefined, thrown by isValidParent from Layout.
I'm not sure whether it's a bug or wether I made an error. If someone knows a hack, or has a solution to make it work, it would be awsome!
Thanks!

Here is my code :


Ext.regController('main',{
back : function() {
var vp = proto.viewport;
var last = proto.viewport.items.last();
vp.setActiveItem(vp.items.getCount() - 2, {
type : 'slide',
direction : 'right',
scope : {vp : vp, last : last},
after : function() {
this.vp.remove(this.last, true);
}
});
},
open : function(options) {
var vp = proto.viewport;
// Get the last title
if (vp.items.last().title)
{
Ext.apply(options.view, {
backTitle : vp.items.last().title,
});
}
vp.add(options.view);
vp.setActiveItem(vp.items.last(), {
type : 'slide',
direction : 'left',
});

}
});


Here is the dipatch :


Ext.dispatch({
controller : 'main',
action : 'open',
view : {
xtype : 'peoplecarousel',
id:'peoplecaroussel'
}
});


And here is the panel :


Ext.extend(Ext.Panel, {
style : 'backgroung-color:#ededed',
layout : {
type : 'vbox',
align : 'stretch'
},
defaults : {
flex : 1
},
listeners : {
beforerender : function(){
//Docked items are here to avoid the dock items bug when recreating panels

this.addDocked({
dock : 'top',
xtype : 'toolbar',
items : [{
//Some items
}]
});
},
},
carousel : new Ext.Carousel({
/*
*Some Code (each card of caroussel contains one panel)
*/
}),
initComponent : function() {
Ext.apply(this, {
items : [this.carousel]
});
proto.views.PeopleCarousel.superclass.initComponent.apply(this, arguments);
}
});


Ext.reg('peoplecarousel', proto.views.PeopleCarousel);

shockie
5 Jan 2012, 3:12 AM
I have the same problem, only on recreating a floating panel. Turned on the breakpoints and as soon as the toolbar of the panel is created(maybe because it's the first item being rendered), the error is thrown.