[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 |