Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5535] MobileWeb: Error occurs when using property visibleItems in Picker object.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-06-13T00:45:18.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsMobileWeb
Labelsn/a
ReporterMisha Vasko
AssigneeMaxim Negadaylov
Created2011-06-10T02:52:01.000+0000
Updated2017-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;
});

Comments

  1. Lee Morris 2017-03-09

    Closing ticket as fixed.

JSON Source