PDA

View Full Version : Need help in navigating through panels and about SetCard method



titu
18 Jul 2010, 8:54 AM
Hi,

I'm new to Sencha touch framework. I'm trying to navigate through different panels. Can you please give some example code that can help me to do that? Also I need to know about the SetCard() method. Which object contains this method? In the Kitchen Sink example I found this method only in event handlers. But can't use this in other places.

P.S: this is my first post. I don't know that is this the right place for posting or not.

Thanks,
Titu

evant
18 Jul 2010, 4:05 PM
The setCard method is automatically injected onto a container that has a layout of type card.

Here's a simple example of using it:



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

var items = [];
for(var i = 0; i < 10; ++i){
items.push({
html: 'Card ' + i
});
}

var p = new Ext.Panel({
width: 400,
height: 400,
layout: 'card',
items: items
}).show();

new Ext.Button({
text: 'Random Card',
handler: function(){
var rand = Math.floor(Math.random() * 10);
p.setCard(rand);
}
}).show();
}
});

titu
18 Jul 2010, 9:40 PM
Thanks Evan. Nice example.