[TIMOB-516] table view does not render properly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:53:21.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Backlog |
Components | iOS |
Labels | defect, ios, iphone, tableview |
Reporter | Nolan Wright |
Assignee | Jeff Haynie |
Created | 2011-04-15T02:30:44.000+0000 |
Updated | 2011-04-17T01:53:21.000+0000 |
Description
from community - rows get cut off/jacked up
see ticket:
http://helpdesk.appcelerator.net/tickets/1398">http://helpdesk.appcelerator.net/tickets/1398
code:
var win = Titanium.UI.createWindow();
win.setBackgroundColor('#EAF6C4');
var e = Titanium.UI.createButton({
style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED,
systemButton:Titanium.UI.iPhone.SystemButton.REFRESH
}); win.setRightNavButton(e);
// var URL = "http://localhost/~neps/test.json";
// var URL = "http://gothamist.com/js/staticRecentEntries.json"">http://gothamist.com/js/staticRecentEntries.json";
var URL = "http://twitter.com/status/user_timeline/sxswist.json?count=30"">http://twitter.com/status/user_timeline/sxswist.json?count=30";
function fetchRows()
{
var data = [];
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function()
{
// convert the response JSON text into a JavaScript object
var entry = eval('(' + this.responseText + ')');
for (var i=0;i<entry.length;i++)
{
var row = Ti.UI.createTableViewRow();
row.height ='auto';
row.hasChild = true;
row.className = 'normal'
var comment = Ti.UI.createLabel({
color:'#222',
font:{fontSize:16,fontWeight:'normal', fontFamily:'Helvetica'},
left:10,
right:10,
top:10,
bottom:10,
height:'auto',
width:'auto',
text:entry[i].text
});
comment.rowNum = i;
row.add(comment);
var url = 'http://twitter.com/sxswist/status/' + entry[i].id;
row.url = url;
data.push(row);
}
// hide loader
toolActInd.hide();
win.setToolbar(null,{animated:true});
// since this is the first page, just set the data since we started out empty
tableView.setData(data);
}
xhr.open("GET",URL);
xhr.send(null);
};
var tableView = Titanium.UI.createTableView();
var toolActInd = Titanium.UI.createActivityIndicator();
toolActInd.style = Titanium.UI.iPhone.ActivityIndicatorStyle.PLAIN;
toolActInd.font = {fontFamily:'Helvetica Neue', fontSize:15,fontWeight:'bold'};
toolActInd.color = 'white';
toolActInd.message = 'Loading...';
//loader start
win.setToolbar([toolActInd],{animated:true});
toolActInd.show();
//loader end
tableView.addEventListener('click', function(e)
{
var rowdata = e.row;
var w = Ti.UI.createWindow({title:'@sxswist',barColor:'#A2CF18'});
var webview = Ti.UI.createWebView();
webview.url = rowdata.url;
webview.addEventListener('load',function(e)
{
Ti.API.debug("webview loaded: "+e.url);
});
w.add(webview);
win.tab.open(w);
});
win.add(tableView);
fetchRows();
e.addEventListener('click', function()
{
//loader start
win.setToolbar([toolActInd],{animated:true});
toolActInd.show();
//loader end
tableView.setData([]);
setTimeout(function()
{
fetchRows();
},1000)
});
win.open();
Attachments
File | Date | Size |
---|---|---|
516.tiff | 2011-04-15T02:30:44.000+0000 | 265796 |
screen-shot-2010-08-26-at-113413-am.png | 2011-04-15T02:30:45.000+0000 | 161372 |
valid, needs test case.
The issue is seen when scrolling the list, then revealing the previously scrolled objects. Occurs on simulator and device.
added screenshot
What's the status of this ticket? This bug is a very big eyesore.
This ticket is still marked 'new' and is not marked as a priority bug for 1.5.0 currently. There has been no work done on it but we will fix it before release if there's time.
I still feel like this ticket should be at higher priority due to the number of watchers listed at the side. I noticed in 1.4.0rc1 that it was fixed momentarily, then after the 1.4.0 official push update, the bug came right back to haunt us.
Do you have any additional information about where this was fixed, and then broken again? There was a very wide gap between rc1 and the 1.4.0 drop.
Here's a test case:
var win = Titanium.UI.currentWindow; var table = Ti.UI.createTableView(); data = []; for (var i=0; i < 40; i++) {
}
table.setData(data); win.add(table);
It appears that the bug will present when there are many vertical layout rows with height set to auto, each with multiple labels added to them with their heights set to auto, and when each row has a different height. Scrolling all the way to the bottom and back to the top with my test code above will reproduce the bug. See the attached screenshot of my simulator.
This issue also pops up when you create a single label over 5 lines and attach it to a tableViewRow with AutoHeight. The label at first is terminated with '...' then when scrolled off the page and back, the rest of the text shows up but is drawn outside the tableview row.
Fixed as part of tableview/view refactoring, duplicate of... a billion other bugs.