Description
Accessing the value property of using the getValue func of a picker always returns undefined
var win = Ti.UI.createWindow({
exitOnClose: true,
layout: 'vertical'
});
var picker = Ti.UI.createPicker({
top:50
});
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'});
picker.add(data);
picker.selectionIndicator = true;
win.add(picker);
win.open();
var showDate = Ti.UI.createButton({
title: 'get value',
bottom: 20
});
showDate.addEventListener('click', function(e) {
console.log('.value ' + picker.value)
console.log('getValue ' + picker.getValue());
});
picker.addEventListener('change', function(evt) {
console.log('Changed ' + evt.value);
});
win.add(showDate)
Repro steps
Add the code above to an existing app.js
Build for Windows
Select a value from the picker
Click the button
Actual
Undefined is logged from the change event and getValue and value prop
Expected
This seems to work fine for date pickers
var _window = Ti.UI.createWindow(); var datePicker = Ti.UI.createPicker({ type: Ti.UI.PICKER_TYPE_DATE, useSpinner: false }); datePicker.addEventListener('change', function(e) { Ti.API.info('change event: value = ' + e.value); }); var button = Ti.UI.createButton({ title: 'Get value' }); button.addEventListener('click', function() { Ti.API.info(datePicker.value); Ti.API.info(datePicker.getValue()); }); _window.add(datePicker); _window.add(button); _window.open()According to the [API doc](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Picker-property-value),
valueonly works with date and time pickers. I also tested the test code on iOS and it returnsundefined, so I would think this is not a bug.Closing as invalid. If incorrect, please reopen.