How to count number of rows in a picker
Is there an easy way to count the amount of rows in a picker? I've been beating my brain around this all morning and can't figure out an easy solution! Please help!
1 Answer
-
Accepted Answer
sounds crazy, but the solution I use is to get the first column and then get the row count from there
var picker = Ti.UI.createPicker(); var data = []; data[0]=Ti.UI.createPickerRow({title:'Bananas',custom_item:'b'}); data[1]=Ti.UI.createPickerRow({title:'Strawberries',custom_item:'s'}); data[2]=Ti.UI.createPickerRow({title:'Mangos',custom_item:'m'}); data[3]=Ti.UI.createPickerRow({title:'Grapes',custom_item:'g'}); // turn on the selection indicator (off by default) picker.selectionIndicator = true; picker.add(data); picker.columns[0].rowCount