[AC-1137] iOS: Can't delete row after dynamically adding section to table view
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2014-07-14T22:32:08.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Ivan Skugor |
Assignee | Mauro Parra-Miranda |
Created | 2014-06-03T10:54:48.000+0000 |
Updated | 2016-03-08T07:37:30.000+0000 |
Description
After table view section is added dynamically (for example, after table view click), deleting table view row does not work.
To see this issue, run this code:
Ti.UI.setBackgroundColor("#fff")
var win = Ti.UI.createWindow({
top: 20,
backgroundColor: "#ccc"
});
var table = Ti.UI.createTableView({
top: 0,
bottom: 0
});
var section = Ti.UI.createTableViewSection({
headerView: Ti.UI.createLabel({ text: "Section" })
});
for (var i = 0; i < 10; i++) {
section.add(Ti.UI.createTableViewRow({
title: "Row " + (i + 1)
}));
}
table.setData([ section ]);
var newSection;
table.addEventListener("click", function(e) {
if (!newSection) {
newSection = Ti.UI.createTableViewSection({
headerView: Ti.UI.createLabel({ text: "Section 0" })
});
newSection.add(Ti.UI.createTableViewRow({
title: "Bleh"
}));
table.insertSectionBefore(0, newSection);
}
else {
var index = e.index, row;
if (e.index < table.data[1].rows.length) {
row = table.data[1].rows[e.index];
}
Ti.API.info('row');
Ti.API.info(row && row.title);
if (row) {
table.deleteRow(row);
}
}
});
win.add(table);
win.open();
Click first time on some row in "Section" to add new section at beginning. After that, click on other rows, you'll see nothing happens.
Check logs, this is error message: Assertion failure in -[UITableView _endCellAnimationsWithContext:]
DUP of TIMOB-17097