PDA

View Full Version : Update panel after remove item



dbottillo
15 Oct 2010, 7:17 AM
i'm have some problem with remove and update a panel

code is:


Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {


var carousel1 = new Ext.Carousel({
defaults: {
cls: 'card'
},
items: [{
html: '<h1>Carousel</h1><p>Navigate the two carousels on this page by swiping left/right or clicking on one side of the circle indicators below.</p>'
},
{
title: 'Tab 2',
html: '2'
},
{
title: 'Tab 3',
html: '3'
}]
});

var button = new Ext.Button({
html: 'move carousel',
handler: function(){
//alert("i am here");
panel1.remove(carousel1, false);
panel1.doComponentLayout();
panel1.doLayout();
panel2.add(carousel1);
//panelInit.setCard(1);
}
});


var panel1 = new Ext.Panel({
layout: {
type: 'vbox',
align: 'stretch'
},
defaults: {
flex: 1
},
items: [carousel1, button]
});

var panel2 = new Ext.Panel({
layout: {
type: 'vbox',
align: 'stretch'
},
defaults: {
flex: 1
},
items: []

});

var panelInit = new Ext.TabPanel({
fullscreen: true,
layout: 'card',
items: [panel1, panel2]
}).show();
}
});

if i click on button, carousel1 is removed by panel1 but to see this happening i have to switch to panel2 (which contains now carousel1) and then go back to panel1
why doComponentLayout (and even doLayout) doesn't refresh the panel?

Daniele

dbottillo
16 Oct 2010, 10:05 AM
anyone?

joseeight
16 Oct 2010, 10:11 AM
Did you try removing the panel, adding the new panel, and then refreshing the layout? You should set everything first before refreshing, then set card. What version of Sencha Touch are you using?