Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28540] Android: allowSelection does not select the table row

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionInvalid
Resolution Date2021-09-24T20:24:50.000+0000
Affected Version/sRelease 10.1.0
Fix Version/sn/a
ComponentsAndroid
Labelsregression
ReporterLokesh Choudhary
AssigneeUnknown
Created2021-09-24T00:02:24.000+0000
Updated2021-09-24T20:44:34.000+0000

Description

Works with SDK 10.0.2.GA.

Steps to reproduce:

1. Create an android app & use the below code in the app.js:
var win = Ti.UI.createWindow();

var createRow = function(title) {
    var row = Ti.UI.createTableViewRow({
        className: 'test',
        height: 80,
        selectedBackgroundColor: '#ff0000'
    });

    var titleLabel = Ti.UI.createLabel({
        font: {
            fontFamily: 'Helvetica-Bold',
            fontSize: 20
        },
        height: 24,
        highlightedColor: '#fff',
        left: 10,
        text: title,
        touchEnabled: false
    });

    row.add(titleLabel);

    return row;
};

var tableData = [];

for (var i = 0, l = 100; i < l; i++) {
    var row = createRow('Row Index # ' + i);
    tableData.push(row);
}

var tableView = Ti.UI.createTableView({
    allowsSelection: true,
    data: tableData,
    rowHeight: 80,
    top: 0
});

win.add(tableView);
win.open();
2. After the app launches tap and hold any tablerow.

Actual result:

1. The tablerow does not get selected & stay selected with the color red.

Expected result:

1. The tablerow should get selected & stay selected with red color.

Comments

  1. Joshua Quick 2021-09-24

    Just to clarify some things... Titanium has never supported the "allowSelection" property on Android. For example, setting this property to false does nothing in the above example code. https://titaniumsdk.com/api/titanium/ui/tableview.html#allowsselection If you tap-and-hold a TableView row with Titanium 9.3.0 - 10.0.2, the row will stay highlighted and it effectively enables a selection mode... but this was actually +unintentional+ when we transitioned TableView to use the Java RecyclerView. This behavior was corrected in 10.1.0 which supports selection when in edit mode and now supports the "allowsSelectionDuringEditing" property on Android.

JSON Source