Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5542] MobileWeb: Method insertRowAfter works incorrect in the tableView

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-05-31T05:45:04.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsMobileWeb
Labelsn/a
ReporterMisha Vasko
AssigneeMaxim Negadaylov
Created2011-05-31T05:18:37.000+0000
Updated2017-03-09T20:50:28.000+0000

Description

The method insertRowAfter adds the row after all rows in the tableView. It should add row after the selected index of the row.
var win = Ti.UI.currentWindow;

var tableView = Ti.UI.createTableView({
	width: 300,
	height: 200,
	top: 90,
	left: 10,
	backgroundColor: '#00ACDC'
});

var addRow = Ti.UI.createButton({
	title: 'addRow',
	width: 50,
	top:0,
	left: 0,
	heigth: 30
});

var delRow = Ti.UI.createButton({
	title: 'delRow',
	width: 50,
	top:0,
	heigth: 30,
	left: 50
});

var selRow = Ti.UI.createButton({
	title: 'selRow',
	width: 50,
	top:0,
	heigth: 30,
	left: 100
});

var deselRow = Ti.UI.createButton({
	title: 'deSelRow',
	width: 50,
	top:0,
	heigth: 30,
	left: 150
});


var insAftRow = Ti.UI.createButton({
	title: 'insAfter',
	width: 50,
	top:30,
	heigth: 30,
	left: 0
});


var insBefRow = Ti.UI.createButton({
	title: 'insBefor',
	width: 50,
	heigth: 30,
	top:30,
	left: 50
});

var label1 = Ti.UI.createLabel({
	top: 60,
	left: 5,
	text: 'Row #:'
});


var tf1= Ti.UI.createTextField({
	width: 50,
	height: 30,
	top:60,
	left: 80
});


win.add(tableView);
win.add(addRow);
win.add(delRow);
win.add(selRow);
win.add(deselRow);
win.add(insAftRow);
win.add(insBefRow);
win.add(tf1);
win.add(label1);



var i = 0;
var newRow = function (){
	row = Ti.UI.createTableViewRow({
		title: 'This is ' + i + ' row'
	});
	i++;
};

addRow.addEventListener('click', function(){
	newRow();
	tableView.appendRow(row);
});

delRow.addEventListener('click', function(){
	tableView.deleteRow(tf1.value);
});

selRow.addEventListener('click', function(){
	tableView.selectRow(tf1.value);
});

deselRow.addEventListener('click', function(){
	tableView.deselectRow(tf1.value);
});

insAftRow.addEventListener('click', function(){
	newRow();
	tableView.insertRowAfter(tf1.value, row);
});

insBefRow.addEventListener('click', function(){
	newRow();
	tableView.insertRowBefore(tf1.value, row);
});

Comments

  1. Lee Morris 2017-03-09

    Closing ticket as fixed.

JSON Source