Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-10146

iOS: setSelectedRow on picker not working if window not open

    Details

      Description

      By default 'Answer 5' should be selected on starting the app but it selects "Answer 0" on iOS. This code works fine on Android but not on iOS.

      var win = Ti.UI.createWindow({
      	layout: 'vertical'
      });
       
      var picker = Ti.UI.createPicker({
      	type: Ti.UI.PICKER_TYPE_PLAIN,
      	selectionIndicator: true
      });
       
       
      var data = [];
      var answerLoop = 0;
       
      // add answers
      for (answerLoop = 0; answerLoop < 11; answerLoop++) {
      	data.push(Ti.UI.createPickerRow({
      		title: 'Answer ' + answerLoop,
      		custom_item: answerLoop
      	}));
      }
       
      picker.add(data);
       
      // THIS IS WHERE THE BUG IS
      // This should selected the value 'Answer 5' but as you can see, Answer 1 is selected at startup
      picker.setSelectedRow(0, 5, true);
       
      var selectedButton = Ti.UI.createButton({
      	title: 'Select Answer 6',
      	width: 300,
      	height: 'auto'
      });
      selectedButton.addEventListener('click', function(e) {
      	picker.setSelectedRow(0, 6, true);
      });
       
      win.add(picker);
      win.add(selectedButton);
       
      win.open();
      
      

      STEPS TO REPRODUCE:

      1. Load the above code into app.js
      2. Run the project on iPhone simulator.

        Attachments

          Activity

            People

            • Assignee:
              vduggal Vishal Duggal (Inactive)
              Reporter:
              aakkinepally Amuktha Akkinepally
            • Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code