[AC-6688] Android: Tableview insertRowAfter/Before works with first section only
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-03-24T19:31:06.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | n/a |
| Reporter | Ahmed Mohamed |
| Assignee | Gary Mathews |
| Created | 2021-03-23T15:25:31.000+0000 |
| Updated | 2021-03-24T22:18:13.000+0000 |
Description
When trying to insert a row in any section below the first section it doesn't work on Android but it works on iOS as it should be.
So insertRowAfter / insertRowBefore doesn't work.
var win = Ti.UI.createWindow();
var sectionOne = Ti.UI.createTableViewSection({
headerTitle: 'Section One'
});
sectionOne.add(Ti.UI.createTableViewRow({
title: 'Row 1'
}));
sectionOne.add(Ti.UI.createTableViewRow({
title: 'Row 2'
}));
var sectionTwo = Ti.UI.createTableViewSection({
headerTitle: 'Section Two'
});
sectionTwo.add(Ti.UI.createTableViewRow({
title: 'Row 3'
}));
sectionTwo.add(Ti.UI.createTableViewRow({
title: 'Row 4'
}));
var table = Ti.UI.createTableView({
data: [sectionOne, sectionTwo]
});
var button = Ti.UI.createButton({
title: "Add Row",
bottom: 16
});
button.addEventListener('click', () => {
var row = Ti.UI.createTableViewRow({
title: "New Row"
});
table.insertRowAfter(2, row, {
animated: true
});
});
win.add(table);
win.add(button);
win.open();
This has been fixed in the latest
masterand10_0_Xbranches. *TEST CASE*const win = Ti.UI.createWindow(); function createSection(header, rows) { const section = Ti.UI.createTableViewSection({ headerTitle: header }); for (let i = 0; i < rows; i++) { section.add( Ti.UI.createTableViewRow({ title:Row #${i}}) ); } return section; } const table = Ti.UI.createTableView({ data: [ createSection('Section #0', 3), createSection('Section #1', 3), createSection('Section #2', 3), ] }); table.addEventListener('click', e => { table.insertRowAfter( e.index, Ti.UI.createTableViewRow({ title:New After Row #${e.index}}) ); table.insertRowBefore( e.index, Ti.UI.createTableViewRow({ title:New Before Row #${e.index}}) ); }); win.add(table); win.open();I haven't seen any related ticket but after build 9_3_x I confirm this issue has been resolved. Thanks