PDA

View Full Version : Is there a removeCard method?



ssdesign
24 Oct 2010, 10:59 PM
Hi,
I have a situation like this.
I create a screen with one card.
Then I use SetCard to add a card to the application.

Now, I want to have a back button that would go back to the first card and remove the card where the back button was.

Is this doable?
What would be the best function to look at?

Thanks a lot.

Animal
24 Oct 2010, 11:10 PM
Container.remove

ssdesign
24 Oct 2010, 11:33 PM
my cod eis like this:



this.p;
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: true,
onReady: function() {
createSplash();
}
});
function createSplash(){
this.easyBtn = new Ext.Button({
minWidth: '50',
minHeight: '20',
text: 'Btn',
border: '0',
cls: 'mtBtn',
style: {
border: 0
},
id: "easy",
handler: tapMe
});
p = new Ext.Panel({
fullscreen: true,
layout: 'card',
items: [
{
itemId: 'mainScreen',
layout: {
width: 300,
type: 'vbox',
align: 'stretch'
},
items: [
{
flex: 1,
cls: 'toplayer'
},
{
flex: 3,
html: '<div id="midsection"></div>'
},
{
flex: 2,
cls: 'toplayer',
items:easyBtn
}
]
}

]
});
p.setCard(0);
}
function tapMe(btn, event){
var backButton= new Ext.Button({
minWidth: '50',
minHeight: '20',
text: 'Btn',
border: '0',
cls: 'mtBtn',
style: {
border: 0
},
id: "newG",
handler: mainScreen
});
p.setCard( new Ext.Panel({
items:[
{
height: 50,
width: 320,
cls: 'boxPad',
layout:{
type: 'hbox'
},
items: [
{html:'Game Level: '}
]
},
{
height: 50,
width: 320,
cls: 'boxPad1',
layout:{
type: 'hbox'
},
items: [
{html:'Image: '}
]
},


{
height: 50,
width: 320,
cls: 'boxPad',
layout:{
type: 'hbox'
},
items:
[backButton]

}

],
//cls : 'card',
preventHide : true,
animation : 'slide'
}), 'slide' );
//p.setCard(0);
}
function mainScreen(){
p.layout.prev({
type: 'slide',
direction: 'right',
});
///p.layout.next.remove; /////////// this is where I am trying to remove the previous card.
}

Animal
25 Oct 2010, 4:23 AM
Why are you removing at all? Card layout is for bringing one child Panel to the front at a time.

And please format your code so that both you and I can read and make sense of nesting hierarchy.

ssdesign
25 Oct 2010, 4:48 AM
Hi,
Sorry about formatting. I copy pasted from dreamweaver.

I an removing because everytime I set this card, I want to have a new layout based on the condition.
Is there any other way I can do it?