[TIMOB-5535] MobileWeb: Error occurs when using property visibleItems in Picker object.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-06-13T00:45:18.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | MobileWeb |
Labels | n/a |
Reporter | Misha Vasko |
Assignee | Maxim Negadaylov |
Created | 2011-06-10T02:52:01.000+0000 |
Updated | 2017-03-09T20:06:23.000+0000 |
Description
When visibleItems property is defined in picker and visibleItems > 1 object i can not get value of picker.getSelectedRow(0).title. The javascript error occurs: Uncaught TypeError: Cannot read property 'title' of undefined. When visibleItems == 1 everything works fine.
var win = Ti.UI.currentWindow;
win.backgroundColor = '#EEE';
var imageView = Ti.UI.createImageView({
left: 48,
top: 70,
width: 225,
height: 225,
backgroundColor: '#888'
});
win.add(imageView);
images = [Titanium.UI.createPickerRow({title:'0.jpg'}),
Titanium.UI.createPickerRow({title:'1.jpg'}),
Titanium.UI.createPickerRow({title:'2.jpg'}),
Titanium.UI.createPickerRow({title:'3.jpg'}),
Titanium.UI.createPickerRow({title:'4.jpg'})];
var picker = Titanium.UI.createPicker({
top: 10,
left: 10,
width: 140,
height: 40,
visibleItems:2
});
var closeButton = Ti.UI.createButton({
title:'Close',
height:40,
width:140,
fontSize: 20,
top:10,
left: 160
});
win.add(closeButton);
win.add(picker);
picker.add(images);
imageView.image = '/images/imageview/' + picker.getSelectedRow(0).title;
closeButton.addEventListener('click', function(){
Titanium.UI.currentWindow.close();
});
picker.addEventListener('change', function(e){
imageView.image = '/images/imageview/' + e.selectedValue;
});
Closing ticket as fixed.