Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17398] Android: TableViewRows do not have custom properties if row not explicitly created

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionCannot Reproduce
Resolution Date2017-06-27T20:34:44.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, parity
ReporterJon Alter
AssigneeEric Merriman
Created2014-07-25T16:43:38.000+0000
Updated2017-06-27T20:34:44.000+0000

Description

Rows that are created by passing an object with properties to the table's data array do not have custom properties set.

Steps to reproduce:

0. Create a Titanium Android app 1. Copy the example code below into the app.js 2. Run the app 3. Notice that when you click on the 1st row, the check mark does not appear. 4. Notice that when you click on the 2nd row, the check mark appears. 5. Notice that "rowId" is being set on both rows, the difference is that the 2nd row is being created via createTableViewRow and the first row is being created by passing an object. 6. Run the same example on iOS and notice that both rows can be checked The issue here is that the custom property "rowId" is not being set on the row when the row is not explicitly created using createTableViewRow.

Test code

var win = Ti.UI.createWindow();
win.open();

var table = Ti.UI.createTableView({
    backgroundColor: '#fff',
    top: 0, bottom: 0
});
win.add(table);
table.addEventListener('click', function (evt) {
    Ti.API.info('##### rowId: ' + evt.row.rowId);
    if (evt.row.rowId) {
        evt.row.hasCheck = !evt.row.hasCheck;
    }
});

var data = [];
data.push({ title: 'Not Checkable', hasCheck:false, rowId: 'test1' });
data.push(Ti.UI.createTableViewRow({ title: 'Checkable', hasCheck:false, rowId: 'test2' }));
table.setData(data);

Comments

  1. jithinpv 2014-08-21

    Issue reproduces in Android with Titanium SDK version 3.4.0 master, 3.3.0.GA It works fine in iOS with Titanium SDK version 3.4.0 master, 3.3.0.GA Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, Android device : Motorola Moto G, Android version : 4.4.4 iOS Device : iphone 4, iOS 7.1 also rowId of row 1 is "undefined" in android and iOS shows rowId as "test1".
  2. Lee Morris 2017-06-27

    I am unable to reproduce this issue with the following environment; Pixel (7.1) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170623141152 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source