Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8942] Android: TableView using minRowHeight fails when tableViewRow has a composite object

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-03-19T08:26:04.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 3.0.2
ComponentsAndroid
Labels2.0.1, TableView, core, parity, tableviewrows
ReporterMilt Grinberg
Assigneejithinpv
Created2012-04-20T11:16:29.000+0000
Updated2017-03-21T21:25:09.000+0000

Description

Issue

If We create a tableView that has a minRowHeight using the new height/width values, The minRowheight appears to be used as the actual height of the row. The failure occurs when assigning the height: Ti.UI.SIZE value to the tableViewRow.

Tested on

Android Emulator 2.2 Droid Razr 2.3.5

Expected behavior

The row is composed of a label with height:Ti.UI.SIZE. If the row is not composed of any object it seems to work ok.

Current behavior

In the failure case: a minRowHeight seems to be used as the actual height of the row. If there is no minRowHeight assigned it appears to use 0 as the height of the row.

Repro sequence

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

// create tab group
var tabGroup = Titanium.UI.createTabGroup();


//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff',
    layout:'vertical'
});
var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Tab 1',
    window:win1
});

var label1 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 1',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win1.add(label1);

//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({  
    title:'Tab 2',
    backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({  
    icon:'KS_nav_ui.png',
    title:'Tab 2',
    window:win2
});

var label2 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 2',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win2.add(label2);



//
//  add tabs
//
tabGroup.addTab(tab1);  
tabGroup.addTab(tab2);  


// open tab group
tabGroup.open();

var aTableView1 = Ti.UI.createTableView ({
	height: Ti.UI.SIZE,
	width: Ti.UI.FILL,
	minRowHeight: 10,
	backgroundColor:'red',
});

var aTableView2 = Ti.UI.createTableView ({
	height: Ti.UI.SIZE,
	width: Ti.UI.FILL,
	backgroundColor:'yellow',
});

Ti.include('helpers.js');
win1.add(Ti.UI.createLabel({text:'This tableView has a minRowHeight set to 10, the Rows have no height or width property and is composed of label with height=Ti.UI.SIZE'}));
win1.add(aTableView1);
addDataRow('row1 minRowHeight',aTableView1);
addDataRow('row2 minRowHeight',aTableView1);

win1.add(Ti.UI.createLabel({text:'This tableView has no minRowHeight, the Rows have no height or width property and is composed of label with height=Ti.UI.SIZE'}));
win1.add(aTableView2);
addDataRow('row1',aTableView2);
addDataRow('row2',aTableView2);


var aTableView11 = Ti.UI.createTableView ({
	height: Ti.UI.SIZE,
	width: Ti.UI.FILL,
	minRowHeight: 10,
	backgroundColor:'red',
});

var aTableView21 = Ti.UI.createTableView ({
	height: Ti.UI.SIZE,
	width: Ti.UI.FILL,
	backgroundColor:'blue',
});

win1.add(Ti.UI.createLabel({text:'This tableView has a minRowHeight set to 10, the Rows have height:Ti.UI.SIZE, width:Ti.UI.FILL and is composed of label with height=Ti.UI.SIZE'}));
win1.add(aTableView11);
addDataRowBad('row1 minRowHeight',aTableView11);
addDataRowBad('row2 minRowHeight',aTableView11);

win1.add(Ti.UI.createLabel({text:'This tableView has a no minRowHeight, the Rows have height:Ti.UI.SIZE, width:Ti.UI.FILL and is composed of label with height=Ti.UI.SIZE'}));
win1.add(aTableView21);
addDataRowBad('row1',aTableView21);
addDataRowBad('row2',aTableView21);

helpers.js

addDataRow = function(theText, theTable) {
	var row = Ti.UI.createTableViewRow({
		layout:'vertical'
	});
	var nameLabel = Ti.UI.createLabel({
		text : theText,
		color : 'black',
		height:Ti.UI.SIZE,
	});
	row.add(nameLabel);
	theTable.appendRow(row);
}

addDataRowBad = function(theText, theTable) {
	var row = Ti.UI.createTableViewRow({
		height:Ti.UI.SIZE,
		width:Ti.UI.FILL,
	});
	var nameLabel = Ti.UI.createLabel({
		height:Ti.UI.SIZE,
		text : theText,
		color : 'black',
	});
	row.add(nameLabel);
	//row.add(nameLabel1);
	theTable.appendRow(row);
}
http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.TableView-property-minRowHeight

Attachments

FileDateSize
AndroidOS_2.2.jpg2012-05-01T00:46:47.000+000077953
Screenshot_2013-03-19-13-29-54.png2013-03-19T08:32:48.000+000052633
Screen Shot 2013-03-19 at 1.52.16 PM.png.jpg2013-03-19T08:37:23.000+0000151228
TableViewRowBug.zip2012-04-20T11:16:29.000+0000750293

Comments

  1. Milt Grinberg 2012-04-20

    In the actual code I had a copy/paste error in the first two labels on the screen. They are not composed of a label and just put the text value on the row.
  2. jithinpv 2013-03-19

    Issue does not reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) Device: Samsung galaxy s duos Android version: 4.0.4 WVGA DISPLAY Android Emulator: Android SDK version: 2.2 HVGA DISPLAY jithinpv
  3. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced.

JSON Source