Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20599] Windows: picker updating data throws unknown exception

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-04-04T16:50:35.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 5.4.0
ComponentsWindows
Labelspicker, qe-5.4.0, windows_phone
ReporterZakhar Zhuravlev
AssigneeKota Iguchi
Created2016-03-16T11:44:43.000+0000
Updated2016-06-13T22:03:16.000+0000

Description

It's affected 5.2.0. How to reproduce:
function onTest() {
	var column = picker.columns[0];
	_.each(column.rows, function(row) {
		column.removeRow(row);
	});
	
	var data = [];
	data[0]=Ti.UI.createPickerRow({title:'2 Bananas'});
	data[1]=Ti.UI.createPickerRow({title:'2 Strawberries'});
	data[2]=Ti.UI.createPickerRow({title:'2 Mangos'});
	data[3]=Ti.UI.createPickerRow({title:'2 Grapes'});
	
	picker.add(data);
}

//----------------------------

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);

$.win.add(picker);
$.win.open();

_.delay(onTest, 2000);

Comments

  1. Kota Iguchi 2016-03-29

    Picker removeRow and Row/Column editing operation (through PickerRow and PickerColum is not implemented yet. Moving this to 5.4.0.
  2. Kota Iguchi 2016-04-01

    Plain Picker still has some issues. Re-opening this.
  3. Kota Iguchi 2016-04-04

    https://github.com/appcelerator/titanium_mobile_windows/pull/606
  4. Kota Iguchi 2016-04-04

    Note:
       _.each(column.rows, function(row) {
       	column.removeRow(row);
       });
       
    I think this sample code may be not quite right because column.removeRow updates column.rows while iteration. So everytime _.each evaluates column.rows, it may have been changed (which causes undesired result). So make sure to use immutable array:
       var rows = column.rows;
       _.each(rows, function(row) {
       	column.removeRow(row);
       });
       
  5. Josh Longton 2016-06-13

    Verified as fixed. Tested on: Microsoft Lumia 640 (8.1) Windows Simulator (8.1) Microsoft Lumia 640 (10) Windows Simulator (10) Windows 10 Pro Studio: 4.7.0.201606100920 Ti SDK: 5.4.0.v20160608165242 Appc NPM: 4.2.7-2 App CLI: 5.4.0-15 Node v4.4.4 *Closing Ticket.*

JSON Source