Details

      Description

      Problem Description

      setActive method is not working in tabgroup. It displays an error “Invalid tab index”.

      Test Environment

      Mac OX X 10.9.2
      Ti SDK 3.1.3.GA, 3.2.0.GA, 3.2.1.GA
      Ti CLI 3.2.1
      Android 2.3.3

      Test Code

      var win1 = Ti.UI.createWindow({
      	title : 'Win 1'
      });
       
      var button = Ti.UI.createButton({
      	color : '#000',
      	style : Ti.UI.iPhone.SystemButtonStyle.BORDERED,
      	title : 'Set Active Tab 1'
      });
       
      button.addEventListener('click', function(e) {
      	tabGroup.setActiveTab(1);
      	//Ti.API.info('****************** activeTab: ' + tabGroup.activeTab);
      });
       
      win1.add(button);
       
      var tab1 = Ti.UI.createTab({
      	icon : 'KS_nav_ui.png',
      	title : 'Tab 1',
      	window : win1
      });
       
      var win2 = Ti.UI.createWindow({
      	title : 'Win 2'
      });
       
      var tab2 = Ti.UI.createTab({
      	icon : 'KS_nav_views.png',
      	title : 'Tab 2',
      	window : win2
      });
       
      var tabGroup = Ti.UI.createTabGroup({
       
      });
       
      tabGroup.addTab(tab1);
      tabGroup.addTab(tab2);
       
      /*
       tabGroup.addEventListener('open', function(e) {
       tabGroup.setActiveTab(1);
       Ti.API.info('****************** activeTab: ' + tabGroup.activeTab);
       });
       */
       
      tabGroup.setActiveTab(1);
       
      tabGroup.open();
       
      //Ti.API.info('********************* activeTab: ' + tabGroup.activeTab);
      
      

      Step to reproduce
      1. Create ti sample project in titanium classic
      2. Update app.js file with sample code
      3. Run on android device/emulator
      4. Check console log for error
      Expected Result

      Tab 2 will select when app is run.

      Actual result

      Tab 1 selected.

      Logs

       
      [ERROR] :  TabGroupProxy: (KrollRuntimeThread) [390,390] Invalid tab index.
       
      
      

      Workaround Code

      var win1 = Ti.UI.createWindow({
      	title : 'Win 1'
      });
       
      var button = Ti.UI.createButton({
      	color : '#000',
      	style : Ti.UI.iPhone.SystemButtonStyle.BORDERED,
      	title : 'Set Active Tab 1'
      });
       
      button.addEventListener('click', function(e) {
      	tabGroup.setActiveTab(1);
      	//Ti.API.info('****************** activeTab: ' + tabGroup.activeTab);
      });
       
      win1.add(button);
       
      var tab1 = Ti.UI.createTab({
      	icon : 'KS_nav_ui.png',
      	title : 'Tab 1',
      	window : win1
      });
       
      var win2 = Ti.UI.createWindow({
      	title : 'Win 2'
      });
       
      var tab2 = Ti.UI.createTab({
      	icon : 'KS_nav_views.png',
      	title : 'Tab 2',
      	window : win2
      });
       
      var tabGroup = Ti.UI.createTabGroup({
       
      });
       
      tabGroup.addTab(tab1);
      tabGroup.addTab(tab2);
       
       
       tabGroup.addEventListener('open', function(e) {
       tabGroup.setActiveTab(1);
       Ti.API.info('****************** activeTab: ' + tabGroup.activeTab);
       });
       
       
      //tabGroup.setActiveTab(1);
       
      tabGroup.open();
       
      //Ti.API.info('********************* activeTab: ' + tabGroup.activeTab);
      
      

      Thanks

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bijuexalture Biju pm
                Reporter:
                mrahman Mostafizur Rahman
                Reviewer:
                Vishal Duggal (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-18420
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration