Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How can I change the window and go back?

Hello,

Do you have an example? It's quite difficult to find sth. about this in the KitchenSink.

My attempt:

#app.js

var data = [
    {title:'Drück mich!', hasChild:true, test:'window.js'}
];

var tableview = Titanium.UI.createTableView({
    data:data
});

win1.add(tableview);

tableview.addEventListener('click', function(e){

    win = Titanium.UI.createWindow({
        url:e.rowData.test,
        title:e.rowData.title,
        backgroundColor:'#fff',
        barColor:'#111'
    });

});

#window.js

var win = Titanium.UI.currentWindow;
win.open()

So the TableView is built correctly, but when I click on the row nothing happens.

Thanks in advance!

— asked April 22nd 2010 by Claus Moritz Gräf
  • eventhandler
  • iphone
0 Comments

2 Answers

  • This is what is working on my app

    reportWindow = Titanium.UI.createWindow({
                    url: e.rowData.destination,
                    title: "Report",
                    backgroundColor: '#fff',
                    barColor: '#111',
                    reportData: e.rowData.reportData
                });
    Titanium.UI.currentTab.open(reportWindow,{animated:true});
    

    The piece of code should be inside your "click" event

    — answered April 22nd 2010 by Raul Riera
    permalink
    0 Comments
  • I tried your code, but it didn't work. When I click on the TableView, nothing happens.

    here's my code:

    var tabGroup = Titanium.UI.createTabGroup();
    
    var win1 = Titanium.UI.createWindow({  
        title:'Home',
        backgroundColor:'#fff'
    });
    var tab1 = Titanium.UI.createTab({  
        title:'Home',
        window:win1
    });
    
    
    
    var win2 = Titanium.UI.createWindow({  
        title:'Meine Freunde',
        backgroundColor:'#fff'
    });
    var tab2 = Titanium.UI.createTab({  
        title:'Freunde',
        window:win2
    });
    
    tabGroup.addTab(tab1);  
    tabGroup.addTab(tab2);  
    
    tabGroup.open();
    
    
    var data = [
        {title:'Drück mich!', hasChild:true, test:'window.js'}
    ];
    
    var tableview = Titanium.UI.createTableView({
        data:data
    });
    
    win1.add(tableview);
    
    tableview.addEventListener('click', function(e){
    
    reportWindow = Titanium.UI.createWindow({
                    url: e.rowData.test,
                    title: "Report",
                    backgroundColor: '#fff',
                    barColor: '#111'
                   // reportData: e.rowData.reportData
                });
                Titanium.UI.currentTab.open(reportWindow,{animated:true});
    
    });
    
    — answered April 23rd 2010 by Claus Moritz Gräf
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.