Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12424] Android: View can't be added to tableViewRow issue

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionInvalid
Resolution Date2013-03-19T15:38:10.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsexalture
ReporterMartin Guillon
AssigneeSunila
Created2012-12-23T15:40:40.000+0000
Updated2017-03-22T21:13:56.000+0000

Description

Issue

If trying to add a view to a tableviewrow after view creation, then nothing happen. Which would also mean a potential memory leak Use the testcase, click on row. A view should be added nothing happens. If you change and the view to row.view, then it works

Tested on

Tested on physical device(Galaxy S2 - 4.2) and Android simulator 4.0

Repro sequence

var win = Titanium.UI.createWindow();
win.backgroundColor = '#ccc';

var tableview = Ti.UI.createTableView();
win.add(tableview);

var rowData = [];
for (var i = 0; i < 10; i++) {
    var row = Ti.UI.createTableViewRow({
        title : 'row ' + i,
        height:90,
        name : 'row ' + i
    });
    row.view = Ti.UI.createView({
    	left:0,
    	right:0,
    	top:0,
    	bottom:0,
        backgroundColor:'blue'
    })
    row.add(row.view);
    rowData.push(row);
};
tableview.data = rowData;

tableview.addEventListener('click', function(e) {
    if(e.row)
    {
    	Ti.API.info('testing ')
    	if (!e.row.menu || e.row.menu === null){
			e.row.menu = Ti.UI.createView({
		        width:50,
		        right:0,
		        backgroundColor:'black'
		    })
		    e.row.add(e.row.menu);
	    }
	    else {
		    e.row.remove(e.row.menu);
		    e.row.menu = null;
	    }
    }
})

win.open();

Comments

  1. Eduardo Gomez 2013-01-24

    @Martin Guillon Please check [JIRA Ticket Checklist](http://docs.appcelerator.com/titanium/latest/#!/guide/How_to_Submit_a_Bug_Report-section-29004732_HowtoSubmitaBugReport-JIRATicketChecklist) and complete this issue. As the ticket misses crucial information that must be included in order for a ticket to be accepted.
  2. Martin Guillon 2013-01-25

    @Eduardo: may be you could tell me what s missing ? I have put a testcase, an android version to test it. What "critical" information are you missing?
  3. Eduardo Gomez 2013-01-25

    Edit: updated labels and format.
  4. Sunila 2013-03-19

    I don't think there is anything wrong here other than the height is not specified for the view. Either give the height or set top and bottom to 0 to occupy the entire row height. Something like e.row.menu = Ti.UI.createView({ width:50, right:0, bottom:0, top:0, backgroundColor:'black' })
  5. Martin Guillon 2013-03-19

    And so what does it behave differently if you add it to the row or to row.view?
  6. Lee Morris 2017-03-22

    Closing ticket as invalid with reference to the above comments.

JSON Source