I thought tableView would dynamically build its height with 'auto' I have the following code, my TableViewRow doesnt show unless I specify a height, am I missing something here?
var row = Ti.UI.createTableViewRow({ height:'auto', }); var titleLabel = Ti.UI.createLabel({ text: 'Row Title', color:'#362510', font:{fontSize:'18dp', fontWeight:'bold'}, left:'3dp', top:'0dp', height: 'auto' , width:Ti.Platform.displayCaps.platformWidth }); row.add(titleLabel); topRowData.push(row); var topTable = Ti.UI.createTableView({ data: topRowData, height:'auto' // will show if I put value in there. }); win.add(topTable);I have to have forgotten something, it doesnt jump out at me.
thanks
4 Answers
Try to add table without height property.
var topTable = Ti.UI.createTableView({ data: topRowData });
The auto height for a tableView is default to 0, and so often times it may not show up. What you are going to want to do is set the height property to this:
height : Ti.Platform.displayCaps.platformHeight
That checks for the height of the device (Note: In pixels), and then it will set your table's height correctly based upon that value.
You might try a height of Ti.UI.SIZE instead of auto. auto can be a little magic at times, but Ti.UI.SIZE is much more consistent (assuming you are using SDK 2.0 or newer). Not sure if it will work on Android or iOS, but I know it works on Mobile Web.
http://developer.appcelerator.com/question/133957/tableview-auto-hight
Your Answer
Think you can help? Login to answer this question!