Navigation Menu

Skip to content

Commit

Permalink
fixed up table view
Browse files Browse the repository at this point in the history
  • Loading branch information
tonylukasavage committed Sep 18, 2011
1 parent d2406bd commit cb86e05
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 43 deletions.
46 changes: 11 additions & 35 deletions Resources/examples/xhr.js
@@ -1,38 +1,14 @@
// create table view data object
Ti.include('../common.js');

var data = [

{title:'Error Callback', hasChild:true, test:'../examples/xhr_error.js'},
{title:'Binary Data', hasChild:true, test:'../examples/xhr_binarydata.js'},
{title:'XML Data', hasChild:true, test:'../examples/xhr_xml.js'},
{title:'XML Properties', hasChild:true, test:'../examples/xhr_properties.js'},
{title:'File Download', hasChild:true, test:'../examples/xhr_filedownload.js'},
{title:'UTF-8 + GET/POST', hasChild:true, test:'../examples/xhr_utf8.js'},
{title:'Cookies', hasChild:true, test:'../examples/xhr_cookie.js'},
{title:'setTimeout', hasChild:true, test:'../examples/xhr_settimeout.js'}
{title:'Error Callback', test:'../examples/xhr_error.js'},
{title:'Binary Data', test:'../examples/xhr_binarydata.js'},
{title:'XML Data', test:'../examples/xhr_xml.js'},
{title:'XML Properties', test:'../examples/xhr_properties.js'},
{title:'File Download', test:'../examples/xhr_filedownload.js'},
{title:'UTF-8 + GET/POST', test:'../examples/xhr_utf8.js'},
{title:'Cookies', test:'../examples/xhr_cookie.js'},
{title:'setTimeout', test:'../examples/xhr_settimeout.js'}
];
// add iphone specific tests
if (Titanium.Platform.name == 'iPhone OS')
{
data.push({title:'File Upload', hasChild:true, test:'../examples/xhr_fileupload.js'});
}
// create table view
var tableview = Titanium.UI.createTableView({
data:data
});

// create table view event listener
tableview.addEventListener('click', function(e)
{
if (e.rowData.test)
{
var win = Titanium.UI.createWindow({
url:e.rowData.test,
title:e.rowData.title
});
Titanium.UI.currentTab.open(win,{animated:true});
}
});

// add table view to the window
Titanium.UI.currentWindow.add(tableview);

Titanium.UI.currentWindow.add(NookKS.createNavigationTableView(data));
6 changes: 3 additions & 3 deletions Resources/examples/xhr_binarydata.js
Expand Up @@ -2,15 +2,15 @@ var win = Titanium.UI.currentWindow;

var l = Titanium.UI.createLabel({
text:'Downloading image...',
font:{fontSize:13},
font:{fontSize:24},
top:10,
left:10,
width:300,
color:'#888'
color:'#999'
});
win.add(l);
var imageView = Titanium.UI.createImageView({
top:50,
top:70,
left:10,
height:100,
width:80
Expand Down
10 changes: 5 additions & 5 deletions Resources/examples/xhr_error.js
Expand Up @@ -2,7 +2,7 @@ var win=Titanium.UI.currentWindow;

var l1 = Titanium.UI.createLabel({
text:'UTF-8 GET',
font:{fontSize:16,fontWeight:'bold'},
font:{fontSize:32,fontWeight:'bold'},
top:10,
width:300,
left:10,
Expand All @@ -12,12 +12,12 @@ win.add(l1);

var l2 = Titanium.UI.createLabel({
text:'Waiting for response...',
font:{fontSize:13},
top:40,
font:{fontSize:24},
top:60,
left:10,
width:300,
height:'auto',
color:'#888'
color:'#999'
});
win.add(l2);

Expand All @@ -30,7 +30,7 @@ xhr.onload = function()

xhr.onerror = function(e)
{
l2.text = e.error;
l2.text = "Status: " + this.status + "\nError: " + e.error + "\nResponse: " + this.responseText;
};

// open the client
Expand Down

0 comments on commit cb86e05

Please sign in to comment.