-
28 Nov 2011 4:57 AM #1
Unanswered: 'Page' navigation on button press - is it possible?
Unanswered: 'Page' navigation on button press - is it possible?
Hello all,
I'm new here and to Sencha Touch. I have spent the past few days trawling through the documentation and videos and haven't yet seen a clear description on making 'pages'/'cards' change when the user presses a button, rather than using either a tab-panel or carousel for navigation.
I have an app I'm making with custom page navigation buttons which is why I can't use a tab-panel or carousel (or can I?). I've been able to create a button and call the 'handler' function when it is clicked/touched but does anyone know how I can make that button move another 'page'/'card' with the usual animations such as 'fade' or 'slide'? Is it even possible?
I'd be extremely grateful if anyone could point me in the right direction. Many thanks in advance
-
28 Nov 2011 7:20 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
All you need is setActiveItem on the Panel:
http://docs.sencha.com/touch/2-0/#!/...-setActiveItemCode:var panel = Ext.create('Ext.Panel', { fullscreen : true, layout : 'card', items : [ { html : 'One' }, { html : 'Two' }, { html : 'Three' } ] }); setTimeout(function() { panel.setActiveItem(1); setTimeout(function() { panel.setActiveItem(2); setTimeout(function() { panel.setActiveItem(0); }, 2000); }, 2000); }, 2000);Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
28 Nov 2011 8:38 AM #3
Hi mitchellsimoens, thanks very much for your response!
I have already tried it as you suggested, using 'setActiveItem()' and this does indeed change the pages as I need. However, what I can't figure out it how to make the pages/cards change using the animations you get when utilizing either the tab panel or carousel navigation (fade, slide etc..)
So, to clarify, instead of the page changes being instant as they are with your recommendation, is it possible to do this adding in the smooth transitional animations?
Again, many thanks for your help
-
28 Nov 2011 8:43 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
- Answers
- 3102
Being in PR stages, animations aren't fully baked into the framework.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
28 Nov 2011 8:58 AM #5
Ok, thanks for the heads-up. I'll keep an ear to the ground for something like this being added in the future.


Reply With Quote