Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24879] [Android]Unable to make a selection when TableView has a table with a Title and a Label

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 6.1.0
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterSamir Mohammed
AssigneeUnknown
Created2017-06-22T20:46:02.000+0000
Updated2018-02-28T19:55:09.000+0000

Description

Unable to make a selection when a TableView has a Title and a Label. Yet on iOS you are able to make a selection. iOS (screenshot): !iOS.png|thumbnail! Android (Screenshot): !Android.png|thumbnail! *Test case:*
var self = Ti.UI.createView({layout: "vertical", top: 20});

    // ------------------------------------------------------------------------| data
    var test_data = [
        {name: "Alabama", capitol: "Montgomery", abrev: "AL", tree: "Longleaf Pine"},
        {name: "Alaska", capitol: "Juneau", abrev: "AK", tree: "Sitka Spruce"},
        {name: "Arizona", capitol: "Phoenix", abrev: "AZ", tree: "Palo Verde"},
        {name: "Arkansas", capitol: "Little Rock", abrev: "AR", tree: "Loblolly Pine"},
        {name: "California", capitol: "Sacramento", abrev: "CA", tree: "Coast Redwood and Giant Sequoia"},
        {name: "Colorado", capitol: "Denver", abrev: "CO", tree: "Blue Spruce"},
        {name: "Connecticut", capitol: "Hartford", abrev: "CT", tree: "White Oak"},
        {name: "Delaware", capitol: "Dover", abrev: "DE", tree: "American Holly"},
        {name: "Florida", capitol: "Tallahassee", abrev: "FL", tree: "Cabbage Palmetto"},
        {name: "Georgia", capitol: "Atlanta", abrev: "GA", tree: "Live Oak"},
        {name: "Hawaii", capitol: "Honolulu", abrev: "HI", tree: "Kukui"},
        {name: "Idaho", capitol: "Boise", abrev: "ID", tree: "Western White Pine"},
        {name: "Illinois", capitol: "Springfield", abrev: "IL", tree: "White Oak"},
        {name: "Indiana", capitol: "Indianapolis", abrev: "IN", tree: "Tulip Poplar"},
        {name: "Iowa", capitol: "Des Moines", abrev: "IA", tree: "Oak"},
        {name: "Kansas", capitol: "Topeka", abrev: "KS", tree: "Eastern Cottonwood"},
        {name: "Kentucky", capitol: "Frankfort", abrev: "KY", tree: "Tulip Poplar"},
        {name: "Louisiana", capitol: "Baton Rouge", abrev: "LA", tree: "Bald Cypress"},
        {name: "Maine", capitol: "Augusta", abrev: "ME", tree: "Eastern White Pine"},
        {name: "Maryland", capitol: "Annapolis", abrev: "MD", tree: "White Oak"},
        {name: "Massachusetts", capitol: "Boston", abrev: "MA", tree: "American Elm"},
        {name: "Michigan", capitol: "Lansing", abrev: "MI", tree: "Eastern White Pine"},
        {name: "Minnesota", capitol: "St. Paul", abrev: "MN", tree: "Red Pine"},
        {name: "Mississippi", capitol: "Jackson", abrev: "MS", tree: "Magnolia"},
        {name: "Missouri", capitol: "Jefferson City", abrev: "MS", tree: "Flowering Dogwood"},
        {name: "Montana", capitol: "Helena", abrev: "MT", tree: "Ponderosa Pine"},
        {name: "Nebraska", capitol: "Lincoln", abrev: "NE", tree: "Eastern Cottonwood"},
        {name: "Nevada", capitol: "Carson City", abrev: "NV", tree: "Singleleaf Pinyon Pine and Bristlecone Pine"},
        {name: "New Hampshire", capitol: "Concord", abrev: "NH", tree: "Paper Birch"},
        {name: "New Jersey", capitol: "Trenton", abrev: "NJ", tree: "Northern Red Oak"},
        {name: "New Mexico", capitol: "Santa Fe", abrev: "NM", tree: "Pinon Pine"},
        {name: "New York", capitol: "Albany", abrev: "NY", tree: "Sugar Maple"},
        {name: "North Carolina", capitol: "Raleigh", abrev: "NC", tree: "Longleaf Pine"},
        {name: "North Dakota", capitol: "Bismarck", abrev: "ND", tree: "American Elm"},
        {name: "Ohio", capitol: "Columbus", abrev: "OH", tree: "Ohio Buckeye"},
        {name: "Oklahoma", capitol: "Oklahoma City", abrev: "OK", tree: "Eastern Redbud"},
        {name: "Oregon", capitol: "Salem", abrev: "OR", tree: "Douglas Fir"},
        {name: "Pennsylvania", capitol: "Harrisburg", abrev: "PA", tree: "Eastern Hemlock"},
        {name: "Rhode Island", capitol: "Providence", abrev: "RI", tree: "Red Maple"},
        {name: "South Carolina", capitol: "Columbia", abrev: "SC", tree: "Cabbage Palmetto"},
        {name: "South Dakota", capitol: "Pierre", abrev: "SD", tree: "Black Hills Spruce"},
        {name: "Tennessee", capitol: "Nashville", abrev: "TN", tree: "Tulip Poplar"},
        {name: "Texas", capitol: "Austin", abrev: "TX", tree: "Pecan"},
        {name: "Utah", capitol: "Salt Lake City", abrev: "UT", tree: "Blue Spruce"},
        {name: "Vermont", capitol: "Montpelier", abrev: "VT", tree: "Sugar Maple"},
        {name: "Virginia", capitol: "Richmond", abrev: "VA", tree: "Flowering Dogwood"},
        {name: "Washington", capitol: "Olympia", abrev: "WA", tree: "Western Hemlock"},
        {name: "West Virginia", capitol: "Charleston", abrev: "WV", tree: "Sugar Maple"},
        {name: "Wisconsin", capitol: "Madison", abrev: "WI", tree: "Sugar Maple"},
        {name: "Wyoming", capitol: "Cheyenne", abrev: "WY", tree: "Plains Cottonwoood"}
    ];


    // ------------------------------------------------------------------------| table 1
    var table_data1 = [];

    table_data1.push(Ti.UI.createTableViewSection({ headerTitle: 'Table 1 with Label only' }));

    for(var i=0,j=test_data.length; i<j; i++){
        var row = Titanium.UI.createTableViewRow({});

        var row_label = Titanium.UI.createLabel({
            text: "state: " + test_data[i].name + "  abrev: " + test_data[i].abrev + "\ncapitol: " + test_data[i].capitol + "\ntree: " + test_data[i].tree,
            textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
            width: Ti.UI.SIZE,
            height: Ti.UI.SIZE,
            left: 15,
            font: {fontSize: "12dp"}
        });

      row.add(row_label);
      table_data1.push(row);
    };

    var table1 = Ti.UI.createTableView({
        data : table_data1,
        height: '33%'
    });

    table1.addEventListener('click', function(e) {
        if (e.row.hasCheck) {
            e.row.hasCheck = false;
        } else {
            e.row.hasCheck = true;
        }
    });

    self.add(table1);


    // ------------------------------------------------------------------------| table 2
    var table_data2 = [];

    table_data2.push(Ti.UI.createTableViewSection({ headerTitle: 'Table 2 with Title only' }));

    for(var i=0,j=test_data.length; i<j; i++){
        var row = Titanium.UI.createTableViewRow({title: "state: " + test_data[i].name, font: {fontSize: "12dp"}});
        table_data2.push(row);
    };

    var table2 = Ti.UI.createTableView({
        data : table_data2,
        height: '33%'
    });

    table2.addEventListener('click', function(e) {
        if (e.row.hasCheck) {
            e.row.hasCheck = false;
        } else {
            e.row.hasCheck = true;
        }
    });

    self.add(table2);


    // ------------------------------------------------------------------------| table 3
    var table_data3 = [];

    table_data3.push(Ti.UI.createTableViewSection({ headerTitle: 'Table 3 with Title and Label' }));

    for(var i=0,j=test_data.length; i<j; i++){
        var row = Titanium.UI.createTableViewRow({title: "state: " + test_data[i].name, font: {fontSize: "13dp"}});

        var row_label = Titanium.UI.createLabel({
            text: "abrev: " + test_data[i].abrev + "\ncapitol: " + test_data[i].capitol + "\ntree: " + test_data[i].tree,
            textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
            width: Ti.UI.SIZE,
            height: Ti.UI.SIZE,
            left: 150,
            top: 10,
            font: {fontSize: "12dp"}
            });

        row.add(row_label);

        table_data3.push(row);
    };

    var table3 = Ti.UI.createTableView({
        data : table_data3,
        height: '33%'
    });

    table3.addEventListener('click', function(e) {
        if (e.rowData.hasCheck) {
            e.rowData.hasCheck = false;
        } else {
            e.rowData.hasCheck = true;
        }
    });

    self.add(table3);
    // ------------------------------------------------------------------------


var win = Ti.UI.createWindow({
	backgroundColor:"gray"
});


win.add(self);

win.open();
*Test Steps:* + Create new Titanium application + Copy the code above in to the application + Run the application + Make a selection in each table *Expected result:* A selection should be made in each table. *Actual result* A selection is only made in the first two tables.

Attachments

FileDateSize
Android.png2017-06-22T20:42:45.000+000096953
iOS.png2017-06-22T20:42:25.000+000062458

Comments

No comments

JSON Source