Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1893] iOS: appendRow returns an error

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2013-04-03T21:05:36.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsDocumentation
Labelsapi
ReporterJohn D. Gauchat
AssigneeShak Hossain
Created2013-01-30T22:45:35.000+0000
Updated2016-03-08T07:40:48.000+0000

Description

*Problem description* appendRow returns the following error:
2013-01-28 19:05:59.154 MyApplication[5447:207] *** Assertion failure in -[_UITableViewUpdateSupport _computeRowUpdates], /SourceCache/UIKit_Sim/UIKit-1912.3/UITableViewSupport.m:386
*Test case*
var counter = 0;

var win = Ti.UI.createWindow({
	backgroundColor : '#FFFFFF'
});

var view = Ti.UI.createView({
	top : 0,
	left : 0,
	width : Ti.UI.FILL,
	height : Ti.UI.FILL,
	layout : 'vertical'
});

var button = Ti.UI.createButton({
	title : ' Add Row ',
	top : 10,
	right : 10,
	width : Ti.UI.SIZE,
	height : Ti.UI.SIZE
});
button.addEventListener('click', function() {
	var row;

	counter++;
	table.setData([]);
	for (var f = 0; f < counter; f++) {
		row = Ti.UI.createTableViewRow({
			title : 'New Account ' + f,
			backgroundColor : '#FFFFFF'
		});

		// Apparently this makes the error display in the console (but doesn't cause it).
		console.log('error trigger');

		table.appendRow(row);
	}
});
view.add(button);

var table = Ti.UI.createTableView({
	top : 0,
	left : 0,
	width : Ti.UI.FILL,
	height : Ti.UI.FILL
});
view.add(table);

win.add(view);
win.open();
*More info* The problem and a sample code were posted in Q&A: http://developer.appcelerator.com/question/147546/error-using-appendrow#comment-156431 Since there were problems before adding row to an empty table, I think this is a bug.

Comments

  1. Daniel Sefton 2013-04-03

    Closed as fixed. John: If you didn't manage to get it working after upgrading to 3.0, let us know.

JSON Source