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.
9 Answers
-
Hi everyone,
i found a solution, see http://developer.appcelerator.com/question/18541/is-there-a-way-to-manage-tab-order-in-a-tab-group
-
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. -
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
-
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-mobilecheers,
Chris. -
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
-
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
-
anyone? i am tired of this already. Titanium has a BUG. 3 weeks and no answer
-
hi, has anyone found a proper fix for this issue?
-
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); } });