Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15760] iOS: Ti.UI.Picker cannot add rows after picker is added to the window

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-04-21T17:54:59.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 24, 2013 Sprint 24 API, Release 3.3.0
ComponentsiOS
Labelsqe-closed-3.3.0, qe-testadded
ReporterPedro Enrique
AssigneePedro Enrique
Created2013-11-21T00:12:41.000+0000
Updated2014-05-02T23:03:38.000+0000

Description

If a picker is created, added to a window, and the window is opened, rows cannot be added. Calling "add" after the fact does nothing. To reproduce: Run this code in app.js and click the button. You'll see that the rows are not added to the picket.
var win = Titanium.UI.createWindow({
    backgroundColor : 'blue'
});
win.open();
 
var box = Ti.UI.createPicker({
    top : 0,
    selectionIndicator : true,
});
 
var btn = Ti.UI.createButton({
    title : 'test',
    height : 50,
    width : 200,
    bottom : 80
});
 
win.add(box);
btn.addEventListener('click', function(e) {
    box.add([{
        title : '123'
    }, {
        title : '12344'
    }]);
});
win.add(btn);

Comments

  1. Pedro Enrique 2013-11-21

    PR: https://github.com/appcelerator/titanium_mobile/pull/5001
  2. Priya Agarwal 2014-04-18

    Reopening this issue as just wanted to confirm the behavior on iOS and Android Test Environment: Appc-Studio:3.2.3.201404162038 sdk:3.3.0.v20140417173316 acs:1.0.14 alloy:1.3.1 npm:1.3.2 titanium:3.2.3-beta titanium-code-processor:1.1.1-beta1 xCODE:5.1.1 Device:Nexus5(v4.4.2),Iphone5(v7.1),Samsung Note(v2.3.6) Used the code mentioned in the bug and observed the below result: Observations on iOS: Run this code in app.js and click the button. Could see the rows getting added on picker. Observations on Android: Run this code in app.js and click the button. Could not see the rows getting added on picker. But as per the documentations http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Picker-method-add add( data ) : void Adds rows or columns to the picker. Parameters • data : Titanium.UI.PickerRow[]/Titanium.UI.PickerRow/Titanium.UI.PickerColumn[]/Titanium.UI.PickerColumnA row, set of rows, a column of rows or a set of columns of rows. When this method is used to add a row or set of rows, a single-column picker is created.
 I modified the code as mentioned below code.
       var win = Titanium.UI.createWindow({
           backgroundColor : 'blue'
       });
       win.open();
         
       var box = Ti.UI.createPicker({
           top : 0,
           selectionIndicator : true,
       });
         
       var btn = Ti.UI.createButton({
           title : 'test',
           height : 50,
           width : 200,
           bottom : 80
       });
         
       win.add(box);
       var data = [];
       data[0]=Ti.UI.createPickerRow({title:'Bananas'});
       data[1]=Ti.UI.createPickerRow({title:'Strawberries'});
       data[2]=Ti.UI.createPickerRow({title:'Mangos'});
       data[3]=Ti.UI.createPickerRow({title:'Grapes'});
       btn.addEventListener('click', function(e) {
           box.add(data);
       });
       win.add(btn);
       
    Observations on iOS and Android Run this code in app.js and click the button. Could see the rows getting added on picker. Please confirm the code and as well as the behavior on both Android and iOS
  3. Olga Romero 2014-05-02

    Tested and verified the fix with: Appcelerator Studio, build: 3.3.0.201405011408 Titanium SDK, build: 3.3.0.v20140501144915 CLI 3.3.0 -dev Device: iPhone 5S iOS 7.0.6 Note: I tested Nexus5 Android version 4.4, it does work

JSON Source