Skip to content

Instantly share code, notes, and snippets.

@nazrdogan
Created April 30, 2014 18:29
Show Gist options
  • Save nazrdogan/0126ea315f9407991fcb to your computer and use it in GitHub Desktop.
Save nazrdogan/0126ea315f9407991fcb to your computer and use it in GitHub Desktop.
Titanium Mobile Editable Table View
Titanium.UI.setBackgroundColor('#000');
// TAB GRUBU OLUŞTUR
var tabGroup = Titanium.UI.createTabGroup();
// ANA WİNDOW OLUŞTURULUR BUNU HTML'DE BODY GİBİ DÜŞÜNEBİLİRİSNİZ
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var data = [
{title:'Window 2 Content 1'},
{title:'Window 2 Content 2'},
{title:'Window 2 Content 3'},
{title:'Window 2 Content 4'}
];
var tab1 = Titanium.UI.createTab({
title:'Tab 1',
window:win1
});
// create table view
var tableview = Titanium.UI.createTableView({
data:data,
editable:true
});
win1.add(tableview);
var addBtn = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.ADD
});
addBtn.addEventListener('click',function(e){
// var alertDialog = Titanium.UI.createAlertDialog({
// title: 'Hello',
// message: 'You clicked the add button',
// buttonNames: ['OK']
// });
// alertDialog.show();
var row = Ti.UI.createTableViewRow( {title:'List Content Appended'});
tableview.appendRow(row);
});
win1.setRightNavButton(addBtn);
tabGroup.addTab(tab1);
tabGroup.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment