Results 1 to 5 of 5

Thread: 'Page' navigation on button press - is it possible?

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    4
    Vote Rating
    0
      0  

    Default '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

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    All you need is setActiveItem on the Panel:

    Code:
    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);
    http://docs.sencha.com/touch/2-0/#!/...-setActiveItem
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    4
    Vote Rating
    0
      0  

    Default

    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

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    Being in PR stages, animations aren't fully baked into the framework.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha User
    Join Date
    Nov 2011
    Posts
    4
    Vote Rating
    0
      0  

    Default

    Ok, thanks for the heads-up. I'll keep an ear to the ground for something like this being added in the future.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •