Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24818] Windows: Calling insertRow with a deleted row errors out application

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-01-05T01:21:18.000+0000
Affected Version/sRelease 6.1.0
Fix Version/sRelease 7.1.0
ComponentsWindows
Labelsn/a
ReporterEwan Harris
AssigneeKota Iguchi
Created2017-06-14T10:44:58.000+0000
Updated2018-03-02T18:29:57.000+0000

Description

Description

When calling insertRow with an existing row, if the row has been deleted then the application will freeze and error out, this code works fine on Android, need to check iOS
var _window = Ti.UI.createWindow();
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);

_window.add(table);

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);

	console.log('delete row');
	table.deleteRow(row);
    console.log('insertRow');
    table.insertRowBefore(0, row);
});
_window.open();

Steps to reproduce

Add the code above to an application

Build for Windows

Tap a row

Actual

Application freezes and errors out

Expected

Application should not freeze or error out,

Comments

  1. Kota Iguchi 2017-06-15

    This works fine on iOS.
  2. Kota Iguchi 2017-12-08

    https://github.com/appcelerator/titanium_mobile_windows/pull/1164
  3. Samir Mohammed 2018-03-02

    Closing ticket; Verified fix in SDK Version: 7.1.0.v20180228160738 and SDK Version: 7.2.0.v20180301101144.

JSON Source