簡體   English   中英

在iPhone版Titanium中,如何從表格視圖過渡到詳細視圖。

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

我已經創建了一個表格視圖,並希望當我單擊一個單元格時出現一個新窗口,並且該單元格數據應該顯示在該窗口中!

我的代碼在這里...

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);

希望這對您有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM