Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8058] MobileWeb: TableView - The method deleteRow of table view produced the error "TypeError: Result of expression 'e.rowData' [undefined] is not an object."

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2012-03-17T14:25:25.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sn/a
ComponentsMobileWeb
Labels"qe-mw020912"
ReporterMichael Pettiford
AssigneeBryan Hughes
Created2012-03-16T12:19:23.000+0000
Updated2014-01-28T23:48:58.000+0000

Description

*Note: This issue is similar to TIMOB-8055 which is linked below, except this is explicitly calling deleteRow and the linked issue sets the table data to remove rows* Steps to reproduce: 1. Create a default mobile web project and change the app.js to the following:

var _window = Titanium.UI.createWindow({
			title : 'test',
			backgroundColor : 'white'
		});

var table = Ti.UI.createTableView({
			title : 'just a test'
		});

		_window.add(table);

		var data = ['goodday', 'goodtime', 'goodboy', 'goodgirl'];
		var arr = [];

		for(var i = 0, max = data.length; i < max; i++) {

			arr[i] = Ti.UI.createTableViewRow({
				title : data[i],
				name : data[i]
			});
		}

		table.setData(arr);
		table.allrows = arr;

		for(var j = 0, len = table.allrows.length; j < len; j++) {
			table.allrows[j].addEventListener('click', function(e) {
				var index = table.getIndexByName(e.rowData.name);
				Ti.API.info(index);
				table.deleteRow(index); // This line should work
			});
		}
_window.open();
2. Run the app 3. Press on the "goodgirl" row Actual result: The table view is loaded but the row isn't deleted and an error of "TypeError: Result of expression 'e.rowData' [undefined] is not an object." Expected result: The table view is loaded and when one clicks a row it is deleted

Comments

  1. Bryan Hughes 2012-03-17

    This is a duplicate of TIMOB-8004
  2. Bryan Hughes 2012-03-17

    It's also worth noting that TableView.getIndexByName is not a documented method in TableView, which will also throw an error.

JSON Source