how can i read data when Click the Table?

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

I made below code. How can i open another window when i click row?

var Table = Ti.UI.createTableView({
 rowHeight:60,
 top:45
});
 
data = [];
List = [
{Image:'IMAGE.png'},
];
 
for (i=0; i<List.length; i++){
var row = Ti.UI.createTableViewRow();
 
  var Image = Ti.UI.createImageView({
 
   width:55,
   height:55,
   left:5
  });
 
   row.add(Image);
    row.className = 'List';     
                        data.push(row);
};
 
Table.setData(data);
Win.add(Table);

2 Answers

Hi Heedoo,

Try this code...

Table.addEventListener('click', function(e) {
 
    var WinNew = Ti.UI.createWindow({
        title : 'New Window'
    });
 
    var Ima = Ti.UI.createImageView({
       width:55,
       height:55,
       left:5,
       image : List[e.index]
      });
    WinNew.add(Ima);
 
    var button = Ti.UI.createButton({
        title : 'Close'
    });
    button.addEventListener('click', function(e) {
        WinNew.close();
    });
    WinNew.leftNavButton = button;
    WinNew.open({
        modal : true
    });
});

— answered 12 months ago by Nitin Chavda
answer permalink
2 Comments
  • A good idea is to open first the new window and the put content in it. This accelerate teh view.

    — commented 12 months ago by Rainer Schleevoigt

  • Okey thanx for such a good guideline......

    — commented 12 months ago by Nitin Chavda

Hello Heedoo...

See this...

Table.addEventListener('click', function(e) {
 
    var win2 =   Ti.UI.createWindow({
        title : 'Table Detail'
        });
 
    Ti.UI.currnetTab.open(win2,{animated : true});
 
});

Your Answer

Think you can help? Login to answer this question!