[AC-1397] iOS: Rendering issue when deleting and re-adding row
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Duplicate |
Resolution Date | 2014-06-16T21:36:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Ivan Skugor |
Assignee | Shuo Liang |
Created | 2014-06-03T10:07:27.000+0000 |
Updated | 2016-03-08T07:37:49.000+0000 |
Description
There's one issue when row is being deleted and then re added.
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) {
var row = table.data[0].rows[e.index];
Ti.API.info('index');
Ti.API.info(e.index);
Ti.API.info(row.title);
table.deleteRow(row);
table.insertRowBefore(0, row);
/*setTimeout(function() {
table.insertRowBefore(0, row);
}, 3000);*/
});
win.add(table);
win.open();
Basically, this code moves clicked row to first position in table.
So, for example, you can click on "Row 2" and it should move before "Row 1".
The problem is that's not what happens. For some reason, there are two "Row 2".
You can click again on second row, and everything resets.
Check the logs, seems to be okay there, just the rendering in not correct.
If timeout is introduced for row re addign (like in commented part), everything will work fine.
Hi, This is a refresh issue. After you delete a row, the page still not refresh, so second action "insertRow" will not work well. I will talk to our engineer team to figure it out whether is it a bug, and keep you up to date. For now, if you really need it shortly, you can add one more action between "delete" action and "insert" action, like do a timeout or Ti.API.info(); Regards, Shuo
I did a timeout, I said that, there's commented part with "setTimeout". I don't understand how can this not be a bug, it's not a feature for sure :D
Filed a ticket to engineer team already.
Great, thank you.