multi-column picker does not set selected row

You must Login before you can answer or comment on any questions.

The KitchenSink example doesn't seem to be able to get the "selected row" feature working - I am running the latest Titanium with iOS 4.1. It always defaults to the first rows on both columns.

Is this a known bug? Any workaround?

— asked 3 years ago by c leung
0 Comments

4 Answers

In the KitchenSink example, there is this picker_multicolumn1.js code as following:

----- code snippet ----------------
var win = Titanium.UI.currentWindow;
win.backgroundColor = 'black';
 
var picker = Ti.UI.createPicker();
 
var column1 = Ti.UI.createPickerColumn({opacity:0});
column1.addRow(Ti.UI.createPickerRow({title:'Bananas',custom_item:'b'}));
column1.addRow(Ti.UI.createPickerRow({title:'Strawberries',custom_item:'s', selected:true}));
column1.addRow(Ti.UI.createPickerRow({title:'Mangos',custom_item:'m'}));
column1.addRow(Ti.UI.createPickerRow({title:'Grapes',custom_item:'g'}));
 
var column2 = Ti.UI.createPickerColumn();
column2.addRow(Ti.UI.createPickerRow({title:'red'}));
column2.addRow(Ti.UI.createPickerRow({title:'green'}));
column2.addRow(Ti.UI.createPickerRow({title:'blue'}));
column2.addRow(Ti.UI.createPickerRow({title:'orange'}));
 
// 2 columns as an array
picker.add([column1,column2]);
 
 
// turn on the selection indicator (off by default)
picker.selectionIndicator = true;
 
------------------------------------------
Supposedly default position of the first column should be at "Strawberries" but from what I see while running the demo, it always sets to "Bananas".

My own code suffers the same problem and I want to verify whether I did things wrong or it is actually a bug. I have tried "picker.setSelectedRow(0, 1, true);" etc to no avail.

Single column works, as properly shown in KitchenSink.

having the exact same issue. going to try with the latest build to see if it's been fixed...

ok, i was able to get around this issue by doing the suggestion here : http://developer.appcelerator.com/question/54261/tiuipickersetselectedrow-not-working

but wish i didn't have to have this work around...

Your Answer

Think you can help? Login to answer this question!