简体   繁体   中英

in Titanium for iPhone, how to transition from table view to detail view.?

I have created a table view and want that when i click a cell then a new window should appear and my cell data should be displayed in that window!!!!....

here my code goes...

var table1 = Titanium.UI.createTableView(
{
    data:[
        {title:"Row 1 - simple row"},
        {title:"Row 2 - Having child", hasChild:true},
        {title:"Row 3 - with Details",hasDetail:true},
        {title:"Row 4 - with Check",hasCheck:true},
        {title:"Row 5 - red background",backgroundColor:"#f00"}
    ]
});

table1.addEventListener('click', function(e){
    if (e.rowData)
    {
        var win5 = Titanium.UI.createWindow({
            //url:e.rowData.test,
            title:e.rowData.title
        });
        win5.open();
    }
})

win1.add(table1);
var table1 = Titanium.UI.createTableView(
{
data:[
    {title:"Row 1 - simple row", url:"<Specify the whole path of your detail.js file>"},
    {title:"Row 2 - Having child", hasChild:true, url:"<Specify the whole path of your detail.js file>"},
    {title:"Row 3 - with Details",hasDetail:true, url:"<Specify the whole path of your detail.js file>"},
    {title:"Row 4 - with Check",hasCheck:true, url:"<Specify the whole path of your detail.js file>"},
    {title:"Row 5 - red background",backgroundColor:"#f00", url:"<Specify the whole path of your detail.js file>"}
]
});

table1.addEventListener('click', function(e){
if (e.rowData)
{
    var win5 = Titanium.UI.createWindow({
        url:e.rowData.url,
        title:e.rowData.title
    });
    win5.open({animated:true});

}
})

win1.add(table1);

Hope this helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM