[TIMOB-3356] iOS: Support TableView Auto Height (on the table itself)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Do |
Resolution Date | 2020-01-09T18:52:00.000+0000 |
Affected Version/s | Release 1.6.2 |
Fix Version/s | n/a |
Components | iOS |
Labels | defect, ios, reported-1.6.1, rplist |
Reporter | Dawson Toth |
Assignee | Eric Merriman |
Created | 2011-04-15T03:43:09.000+0000 |
Updated | 2020-01-09T18:52:00.000+0000 |
Description
Problem
If you set the height of a table view to "auto", its height will end up as 0 regardless of its content.
Expected Behavior
A table view with height: 'auto' should calculate its height based on the heights of its rows.
Log
[WARN] [object TiUITableView] has an auto height value of 0, meaning this view may not be visible.
Sample Code
The following code demonstrates the problem. Note that you can set "workaround" to true to calculate the height by spinning through the rows.
var win = Ti.UI.createWindow({
backgroundColor: '#999'
});
var rows = [
{ title: "Row 1", height: 30 },
{ title: "Row 2", height: 45 },
{ title: "Row 3", height: 15 },
{ title: "Row 4", height: 30 },
{ title: "Row 5", height: 25 }
];
var table = Titanium.UI.createTableView({
top: 0,
data: rows,
height: 'auto'
});
var workaround = false;
if (workaround) {
var height = 0;
for (var i = 0, l = rows.length; i < l; i++) {
height += rows[i].height;
}
table.height = height;
}
win.add(table);
win.open();
Associated Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/76514">http://developer.appcelerator.com/helpdesk/view/76514
I'm having this issue as well. height:'auto' just returns zero for the height. Thanks for the workaround Dawson.
I am finding that the message: [WARN] [object TiUITableView] has an auto height value of 0, meaning this view may not be visible. is reporting on Vertical layouts too, this is not just confined to table layouts. height: 'auto', is not being reported properly in: Ti.UI.createLabel Ti.UI.createView
The workaround cannot work with variable height rows, which is a pretty frequent occurrence. Is there anything possible here on v1.7.2? The API itself has to know the actual height of its content, it's just a matter of making available. This is hardly trivial, at least minor.
It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. Updating, or creating code may not reproduce the issue reported, or be a valid test case. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.