Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17097] iOS: Rendering issue when deleting and re-adding row

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-08-27T09:55:02.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.4.0
ComponentsiOS
Labelsmodule_tableview, qe-manualtest
ReporterShuo Liang
AssigneeIngo Muschenetz
Created2014-06-10T00:56:57.000+0000
Updated2014-08-27T09:55:02.000+0000

Description

There's one issue when row is being deleted and then re added.
Ti.UI.setBackgroundColor("#fff");
 
var win = Ti.UI.createWindow({
    top: 20,
    backgroundColor: "#ccc"
});
 
var table = Ti.UI.createTableView({
    top: 0,
    bottom: 0
});

var tableData = [];
 
for (var i = 0; i < 10; i++) {
    tableData.push(Ti.UI.createTableViewRow({
        title: "Row " + (i + 1)
    }));
}

table.setData(tableData);

win.add(table);
 
//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);
    //Ti.API.info('delete an row');
    table.insertRowBefore(0, row);  
    //Ti.API.info('add an row');
    /*setTimeout(function() {
        table.insertRowBefore(0, row);
    }, 2); */
 
});
 
win.open();
Base on the above code, the behave of delete and insert row will not work well. I think it is because when we do the delete action, the device page will still not refresh well, then the second action will not work properly.

Attachments

FileDateSize
Acutal.png2014-06-13T00:19:38.000+000051158
Expect.png2014-06-13T00:19:38.000+000058288

Comments

  1. Shuo Liang 2014-06-10

    Properly need a new tableview.refresh API. Because every time make change to table view, has to be refreshed before make the next move.
  2. Shuo Liang 2014-06-10

  3. Shuo Liang 2014-06-13

    Oh, Ok. When you run the above code. and click the row 5. Actual result: Attachment 1 Expect result: Attachment 2
  4. Shameer Jan 2014-08-26

    Issue reproduces on SDK Version 3.3.0 But can't reproduce on SDK 3.4.0 Titanium Command-Line Interface, CLI version 3.3.0, Titanium SDK version 3.3.0 GA Titanium SDK version 3.4.0.GA Appcelerator Studio, build: 3.3.0.201407111535 iOS SDK: 7.1 iOS iPhone Simulator: 7.1
  5. Satyam Sekhri 2014-08-27

    Tableview rows are in expected order after deleting and inserting a row. Verified on: AppC Studio: 3.4.0.201408251831 SDK: 3.4.0.v20140826143313 CLI: 3.4.0-dev Alloy: 1.5.0-dev Xcode: Xcode6-beta6 iOS Device: iPhone 4(v7.1), iPad4(v8.0 beta)

JSON Source