Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25274] Windows: setData does not add UI elements that already existed

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-01-18T19:15:19.000+0000
Affected Version/sRelease 6.1.2, Release 7.0.0, Release 6.2.0
Fix Version/sRelease 7.1.0
ComponentsWindows
Labelsn/a
ReporterEwan Harris
AssigneeKota Iguchi
Created2017-09-13T14:28:19.000+0000
Updated2018-03-02T18:42:02.000+0000

Description

Description

When calling setData, child elements of the TableViewRow that have been added once are not added
var _window = Ti.UI.createWindow({ backgroundColor: 'green' });
var data = [];
var row = Ti.UI.createTableViewRow();
var lbl = Ti.UI.createLabel({
    text: 'label'
})
row.add(lbl)
data.push(row);
var table = Titanium.UI.createTableView({
    top: 100,
    data: data
});
var btn = Ti.UI.createButton({
    title: 'Add new data',
    top: 5
});
btn.addEventListener('click', function() {
    var newData = [];
    var newRow = Ti.UI.createTableViewRow();
    var newLbl = Ti.UI.createLabel({
        text: 'label again'
    })
    newRow.add(newLbl)
    newData.push(newRow);
    table.setData(newData)
});
var oldbtn = Ti.UI.createButton({
    title: 'Add old data',
    top: 50
});
oldbtn.addEventListener('click', function() {
    table.setData(data)
})
_window.add(btn);
_window.add(oldbtn)
_window.add(table);
_window.open()

Steps to reproduce

Add the above code to an existing app.js and build for Windows

Click 'Add old data' button

Click 'Add new data' button

Actual

'Add old data' does not add the label to the tableviewrow

Expected

The label should be visible in both cases

Comments

  1. Ewan Harris 2017-09-13

    This looks to have started somewhere along the 6_0_X -> 6_1_X path
  2. Kota Iguchi 2017-12-07

    https://github.com/appcelerator/titanium_mobile_windows/pull/1166
  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