Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

inserting and displaying data in SQLite

$
0
0

Hello, I am new to app development and I would really appreciate if someone could demonstrate to me how I can insert this data into SQLite DB and also display in a table format in another window. Thank you

var win = Titanium.UI.currentWindow;
var view = Titanium.UI.createView();
 
var scrollView = Titanium.UI.createScrollView({
    contentWidth : Ti.UI.FILL,
    contentHeight : Ti.UI.FILL,
    top : 0,
    showVerticalScrollIndicator : true,
    showHorizontalScrollIndicator : false
});
win.add(scrollView);
scrollView.add(view);
 
var tableData = [{
    title : 'Project'
}, {
    title : 'Client'
}, {
    title : 'Hourly Rate'
}, {
    title : 'Project Manager'
}, {
    title : 'Comments'
}];
 
var texts = Ti.UI.createView({
    backgroundColor : 'white',
    top : 0,
    left : '30%',
    //bottom : 100,
    width : Ti.UI.FILL,
    height : '80%',
    borderColor : '#F49831'
 
});
 
 
 
var tableView = Ti.UI.createView({
    backgroundColor : 'grey',
    top : 0,
    left : 0,
    width : '30%',
    //bottom : 100,
    height : '80%',
    borderColor : '#F49831'
});
 
var table = Ti.UI.createTableView({
    minRowHeight : 73,
    width : Ti.UI.FILL,
    top : 5,
    left : 0,
    data : tableData
});
win.add(tableView);
tableView.add(table);
 
//Create a textArea for the user to type
var project = Ti.UI.createTextArea({
    width : Ti.UI.FILL,
    top : 0,
    left : 0,
    height : '21%',
    borderColor : '#F49831',
    color : '#888',
    backgroundColor : 'transparent',
    font : {
        fontSize : 14,
        fontWeight : 'bold'
    }
});
 
var client = Ti.UI.createTextArea({
    width : Ti.UI.FILL,
    top : '21%',
    left : 0,
    height : '19.5%',
    borderColor : '#F49831',
    color : '#888',
    //value : notesMenu.value,
    backgroundColor : 'transparent',
    font : {
        fontSize : 14,
        fontWeight : 'bold'
    }
});
 
var hourlyRate = Ti.UI.createTextArea({
    width : Ti.UI.FILL,
    top : '40.4%',
    left : 0,
    height : '19.6%',
    borderColor : '#F49831',
    color : '#888',
    backgroundColor : 'transparent',
    font : {
        fontSize : 14,
        fontWeight : 'bold'
    }
});
 
var projectManager = Ti.UI.createTextArea({
    width : Ti.UI.FILL,
    top : '60%',
    left : 0,
    height : '19.5%',
    borderColor : '#F49831',
    color : '#888',
    backgroundColor : 'transparent',
    font : {
        fontSize : 14,
        fontWeight : 'bold'
    }
});
 
var comments = Ti.UI.createTextArea({
    width : Ti.UI.FILL,
    top : '79.5%',
    left : 0,
    height : '21%',
    borderColor : '#F49831',
    color : '#888',
    backgroundColor : 'transparent',
    font : {
        fontSize : 14,
        fontWeight : 'bold'
    }
});
 
var addExpense = Titanium.UI.createLabel({
    left : 0,
    right : 0,
    text : "Add Expenses",
    color : '#F49831',
    top : '80%',
    bottom : '10%',
    textAlign : "center",
    borderColor : '#F49831',
    backgroundColor : 'grey'
 
});
 
var bottomBar = Ti.UI.createView({
 
    width : Ti.UI.FILL,
    height : '10%',
    bottom : 0,
    borderColor : '#F49831',
    backgroundColor : 'lightGrey'
 
});
 
var saveButton = Ti.UI.createButton({
    backgroundColor : '#F49831',
    title : 'Login',
    top : 10,
    left : 0,
    width : 200,
    bottom : 10,
    font : {
        fontFamily : 'Arial',
        fontWeight : 'bold',
        fontSize : 10
    }
 
});
 
 
win.add(view);
view.add(tableView);
tableView.add(table);
view.add(table);
view.add(texts);
texts.add(project);
texts.add(client);
texts.add(hourlyRate);
texts.add(projectManager);
texts.add(comments);
view.add(addExpense);
view.add(bottomBar);
bottomBar.add(saveButton);

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>