Skip to content

Instantly share code, notes, and snippets.

@davidhemphill
Created August 24, 2009 19:07
Show Gist options
  • Save davidhemphill/174072 to your computer and use it in GitHub Desktop.
Save davidhemphill/174072 to your computer and use it in GitHub Desktop.
window.onload = function()
{
var messages = {};
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function()
{
// convert the response JSON text into a JavaScript object
var json = eval('(' + this.responseText + ')');
// pull out the rows property which should return an array of rows
var rows = json['rows'];
// Figure out how to make the title show up in the table row
for (var c=0;c<rows.length;c++)
{
messages[rows[c].title]=rows[c].title;
}
}
xhr.open("GET", "http://lebanonfamilychurch.org/mobile/messages/");
xhr.send(null);
var optionSection = Titanium.UI.iPhone.createGroupedSection({header:'Message Series', type:'option', data:rows});
// create the grouped view
var groupedView = Titanium.UI.iPhone.createGroupedView();
groupedView.addSection(optionSection);
// add view to the window
Titanium.UI.currentWindow.addView(groupedView);
// show view
Titanium.UI.currentWindow.showView(groupedView);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment