Created
April 17, 2010 16:58
-
-
Save cloudmanic/369679 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Titanium.UI.setBackgroundColor('#000'); | |
var tabGroup = Titanium.UI.createTabGroup(); | |
var win1 = Titanium.UI.createWindow({ | |
url:'categories.js', | |
title:'Categories', | |
barColor:'#670000', | |
catid: 0 | |
}); | |
var tab1 = Titanium.UI.createTab({ | |
icon:'images/tabs/KS_nav_views.png', | |
title:'Categories', | |
window:win1 | |
}); | |
var win2 = Titanium.UI.createWindow({ | |
url:'favorites.js', | |
title:'Favorites', | |
barColor:'#670000' | |
}); | |
var tab2 = Titanium.UI.createTab({ | |
icon:'images/tabs/KS_nav_ui.png', | |
title:'Favorites', | |
window:win2 | |
}); | |
var win3 = Titanium.UI.createWindow({ | |
url:'search.js', | |
title:'Search', | |
id: 10 | |
}); | |
var tab3 = Titanium.UI.createTab({ | |
icon:'images/tabs/KS_nav_ui.png', | |
title:'Search', | |
window:win3 | |
}); | |
tabGroup.addTab(tab1); | |
tabGroup.addTab(tab2); | |
tabGroup.addTab(tab3); | |
tabGroup.setActiveTab(1); | |
tabGroup.open({ transition:Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.currentWindow; | |
win.backgroundImage='images/chip.jpg'; | |
var db = Ti.Database.open('test'); | |
var rows = db.execute('SELECT * FROM Categories WHERE CategoriesParentId = ' + win.catid); | |
if(rows.getRowCount() > 0) { | |
alert('woot'); | |
var data = []; | |
var section = Ti.UI.createTableViewSection(); | |
data.push(section); | |
while(rows.isValidRow()) | |
{ | |
var row = Ti.UI.createTableViewRow(); | |
row.backgroundColor = '#670000'; | |
row.selectedBackgroundColor = '#670000'; | |
row.height = 35; | |
row.hasChild = true; | |
row.id = rows.fieldByName('CategoriesId'); | |
row.name = rows.fieldByName('CategoriesName'); | |
var item = Ti.UI.createLabel({ | |
color: '#fff', | |
text: rows.fieldByName('CategoriesName'), | |
font: {fontSize:20, fontWeight:'bold'}, | |
left: 10, | |
height: 30 | |
}); | |
row.add(item); | |
section.add(row); | |
rows.next(); | |
} | |
rows.close(); | |
var tableview = Titanium.UI.createTableView({ | |
data:data, | |
style:Titanium.UI.iPhone.TableViewStyle.GROUPED, | |
backgroundColor:'transparent', | |
separatorColor:'#390A0E' | |
}); | |
// create table view event listener | |
tableview.addEventListener('click', function(e) | |
{ | |
var win = Ti.UI.createWindow({ url:'categories.js', backgroundImage: 'images/chip.jpg', barColor:'#670000', catid: e.rowData.id}); | |
Ti.UI.currentTab.open(win,{animated:true}); | |
}); | |
win.add(tableview); | |
} else { | |
Ti.include('merchant-list.js'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.currentWindow; | |
win.backgroundImage='images/chip.jpg'; | |
var data = []; | |
var section = Ti.UI.createTableViewSection(); | |
data.push(section); | |
var db = Ti.Database.open('test'); | |
var rows = db.execute('SELECT * FROM Merchants WHERE LastCategory = ' + win.catid); | |
if(rows.getRowCount() > 0) { | |
while(rows.isValidRow()) | |
{ | |
var row = Ti.UI.createTableViewRow(); | |
row.backgroundColor = '#670000'; | |
row.selectedBackgroundColor = '#670000'; | |
row.height = 35; | |
row.hasChild = true; | |
row.id = rows.fieldByName('MerchantsId'); | |
row.name = rows.fieldByName('MerchantsName'); | |
var item = Ti.UI.createLabel({ | |
color: '#fff', | |
text: rows.fieldByName('MerchantsName'), | |
font: {fontSize:20, fontWeight:'bold'}, | |
left: 10, | |
height: 30 | |
}); | |
row.add(item); | |
section.add(row); | |
rows.next(); | |
} | |
rows.close(); | |
} | |
var tableview = Titanium.UI.createTableView({ | |
data:data, | |
style:Titanium.UI.iPhone.TableViewStyle.GROUPED, | |
backgroundColor:'transparent', | |
separatorColor:'#390A0E' | |
}); | |
// create table view event listener | |
tableview.addEventListener('click', function(e) | |
{ | |
var win = Ti.UI.createWindow({ url:'merchant.js', backgroundImage: 'images/chip.jpg', barColor:'#670000', id: e.rowData.id}); | |
Ti.UI.currentTab.open(win,{animated:true}); | |
}); | |
win.add(tableview); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment