description
Ti.UI.TableView
has a number of functions that add or remove rows. Those functions take a parameter that allows you to specify an animation for these operations. All of the functions will perform an animation by default, which the exception of [appendRow()](
http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.TableView-method-appendRow). I think
appendRow()
should default to having an animation, just like all the other functions.
expected
[Ti.UI.TableView.appendRow()](
http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.TableView-method-appendRow) should be animated by default.
actual
[Ti.UI.TableView.appendRow()](
http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.TableView-method-appendRow) is not animated by default.
test case
The test case here shows that while
insertRowBefore()
and
deleteRow()
are animated by default,
appendRow()
is not.
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
// create table with some filler rows
var table = Ti.UI.createTableView({
top: 0,
bottom: 50
});
var rows = [];
for (var i = 0; i < 3; i++) {
rows.push({ title: 'title ' + (i+1) });
}
table.setData(rows);
// create tabbedbar for appending, inserting, and deleting
var tabbed = Ti.UI.createTabbedBar({
height: 50,
bottom: 0,
labels: ['append', 'insert', 'delete']
});
tabbed.addEventListener('click', function(e) {
switch(e.index) {
case 0:
table.appendRow({ title: 'append' });
break;
case 1:
table.insertRowBefore(0, { title: 'insert' });
break;
case 2:
table.deleteRow(table.sections[0].rows[0]);
break;
}
});
win.add(tabbed);
win.add(table);
win.open();
No comments