add event listener to top button that is created when clicking a table row

You must Login before you can answer or comment on any questions.

I have one screen that has a bunch of rows that pull in data from a web server. When I click each row I create a new window with a title that is the name of the row.

This new window had a comments field and the top of the window has a back button. How do I add an event listener to that back button?

below is the code for my table click:

table.addEventListener('click', function(e)
{
    if (e.rowData)
    {
        var win = Titanium.UI.createWindow({
            title:e.rowData.children[0].text,
            url:'areacapture.js'
        });
 
        //var db2 = Ti.Database.open('commentsDB');
        //db1.execute('CREATE TABLE IF NOT EXISTS area (comments TEXT)');
 
        Titanium.UI.currentTab.open(win,{animated:true});
 
 
    }
});
areacapture.js:
var currentWin = Ti.UI.currentWindow;
 
var db1 = Ti.Database.open('comments');
 
var overallComment = Titanium.UI.createTextField({  
    color:'#336699',  
    top:10,  
    left:10,  
    width:300,  
    height:80,  
    hintText:'Comments...',  
    keyboardType:Titanium.UI.KEYBOARD_DEFAULT,  
    returnKeyType:Titanium.UI.RETURNKEY_DEFAULT,  
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED  
});  
 
 
 
currentWin.add(overallComment);
my goal is whatever is typed in the comment field i store in the DB that i create when i click back so that when the person comes back the comment is still there...i know i will have to create a if statement first checking to see if there are comments in the db but i want to do this one step at a time

1 Answer

With more searching I found this and solved my problem beautifully

[inline link text] http://developer.appcelerator.com/question/36781/navigation-group-back-button-event#197661

Your Answer

Think you can help? Login to answer this question!