Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

tabGroup arranging

Please could anyone solve this issue? I had written 3 posts about it. Problem is that if your app has more than 5 tabs and if you tap More and then Edit and rearrange the tabs and then exit the app and open it again - arrangement will be lost. There is NO WAY to get current tab order (after arrangement) to save it.

— asked April 1st 2010 by Vitali Virulaine
  • tabgroup
0 Comments

9 Answers

  • Hi Vitaly,

    Perhaps when the user changes tabs you could put the tab data in an array and store it using property.setList. Then from app.js (if the property is not null) read the array from the list to build your tabs using getList (The array will need to be JSON compatible).

    That should do what you need here - so long as you cater for there being nothing in the property - when they first run the app or never change the order.

    cheers
    Chris.

    — answered April 1st 2010 by Chris Reed
    permalink
    0 Comments
  • hm..how can I put tab data into array? Tabs have only windows. I tried to get tab info after arrangement - no luck, it gives same as when the tabGroup was created. I don't see how to catch any changes when tabs were rearranged. Same tabGroup properties all the time

    — answered April 1st 2010 by Vitali Virulaine
    permalink
    0 Comments
  • Hi Vitaly,

    You're right there is no event specifically triggered when a tabGroup is rearranged, but since you only want to store the data between sessions you could put the code in an event that fires when the app is shutdown

    This thread here has more info on that specific topic:
    http://developer.appcelerator.com/question/4931/how-to-trap-startup-and-shutdown-events-in-titanium-mobile

    cheers,
    Chris.

    — answered April 1st 2010 by Chris Reed
    permalink
    0 Comments
  • Thanks, Chris, but unfortunately these is no way to get current (rearranged) tabs order. I have tried many ways to do so - no luck. If you are able to get rearranged tabs order - please paste here the code. Thanks

    — answered April 2nd 2010 by Vitali Virulaine
    permalink
    0 Comments
  • Please anyone solve this issue, i am waiting for many weeks. It is NOT possible to get rearranged tabs order AFTER the arrangement. It is base functionality and it's very annoying that user cannot reorder tabs and save this ordering. FIX THIS PLEASE

    — answered April 13th 2010 by Vitali Virulaine
    permalink
    0 Comments
  • anyone? i am tired of this already. Titanium has a BUG. 3 weeks and no answer

    — answered April 16th 2010 by Vitali Virulaine
    permalink
    0 Comments
  • hi, has anyone found a proper fix for this issue?

    — answered January 10th 2011 by soemarko ridwan
    permalink
    1 Comment
    • see code…

      — commented January 10th 2011 by Aaron Saunders
  • This is not really a fix per se but it can point you in the right direction

    When the tab group events are fired, you can loop through the tabGroup and get the order yourself, save it and utilize it later

    When the application exits, the pause event is triggered… save the data

    When the tab group changes focus, the focus event is triggered… save data

    Code Snippet

    tabGroup.addEventListener('focus', function(e){
        for ( var t in tabGroup.tabs ) {
           Ti.API.info("ORDER - focus " + tabGroup.tabs[t].title);
        }
    });
    
    tabGroup.addEventListener('blur', function(e){
        for ( var t in tabGroup.tabs ) {
           Ti.API.info("ORDER - tab blur" + tabGroup.tabs[t].title);
        }
    });
    Ti.App.addEventListener('pause', function(e){
        for ( var t in tabGroup.tabs ) {
           Ti.API.info("ORDER - app pause" + tabGroup.tabs[t].title);
        }
    });
    
    — answered January 10th 2011 by Aaron Saunders
    permalink
    3 Comments
    • Unfortunatelly this will not work because tabs order in tabGroup.tabs is not changing after rearranging

      — commented February 16th 2011 by Vitali Virulaine
    • What release of sdk and what platform are you on this approach was tested.on iOS, I will need to confirm the version of the sdk

      — commented February 16th 2011 by Aaron Saunders
    • @Vitali it works, I just retested it with 1.6.0 on iphone… please post your code if it is not working for you

      — commented February 16th 2011 by Aaron Saunders
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.