PDA

View Full Version : Starting with Sencha Touch



Luis Armando
30 Dec 2010, 7:23 PM
Hey everyone, I'm new with Sencha Touch I come from a heavy raw javascript or jQuery only background and I'm having fun using this new framework =) however I haven't figured out yet how to make it so that when someone "taps" on a button I have on the upper-right side of a toolbar the panel slides to display a completely new toolbar and panel. Could someone please give me a hand? I've googled for hours now but haven't been able to figure this one out =). Thanks

ed.canas
30 Dec 2010, 7:43 PM
Look at the kitchensink sample it uses setActiveItem to switch to a different card/panel

Example:

this.ui.setActiveItem(cardname,
{
type: 'slide',
reverse: 'false',
});

Luis Armando
30 Dec 2010, 7:50 PM
I am looking at the kitchensink actually, it uses "demo.Animation.slide" (at least the example I'm looking at) and I can't figure where the "demo" object gets created. Also for this code you gave me I'm assuming I can place it inside the handler for the button that will trigger the action, am I right?


Look at the kitchensink sample it uses setActiveItem to switch to a different card/panel

Example:

this.ui.setActiveItem(cardname,
{
type: 'slide',
reverse: 'false',
});

ed.canas
30 Dec 2010, 8:03 PM
If you open up animation.js you will see how the demo.Animation.slide gets declared/created

Basically anytime you click on any item in the navigation panel it calls the onNavPanelItemTap function found in index.js, and in there you will see the this.setActiveItem(card, anim || 'slide'); function.

So to make something similar you would create your own onNavPanelItemTap function.. eg



function SwitchPanel(card, anim) {
if (card) {
sink.Main.ui.setActiveItem(card, anim || 'slide');
}