Description
Calling setSelectedRow causes no change in the UI
var _window = Ti.UI.createWindow();
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);
picker.setSelectedRow(0, 5, true);
console.log(picker.selectedRow);
var selectedButton = Ti.UI.createButton({
title: 'Select Answer 6',
width: 300,
height: 'auto',
top: 50
});
selectedButton.addEventListener('click', function(e) {
picker.setSelectedRow(0, 6, true);
console.log(picker.selectedRow);
});
_window.add(picker);
_window.add(selectedButton);
_window.open()
Steps to reproduce
1. Add the above code to an existing app.js
2. Build for Windows
3. Click 'Select Answer 6'
Actual
On startup Answer 5 should be shown, after clicking the button home Answer 6 should be shown
Expected
Picker remains blank
I think the ticket description is not right. According to the API doc there's no
selectedRow
property defined in the Picker API. (See also http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.PickerRow). I would rename this to "Picker.setSelectedRow doesn't work". For the issue aroundPicker.setSelectedRow
which actually didn't work, I pushed a PR: https://github.com/appcelerator/titanium_mobile_windows/pull/1111 Test Case:[~kiguchi] Yeah you're right, sorry about that. I'll update the ticket accordingly
6_3_X: https://github.com/appcelerator/titanium_mobile_windows/pull/1124
Verified in 6.3.0.v20171006185117 and 7.0.0.v20171009065347