Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Not getting the value from table row

$
0
0

Hi I trying to create a calender view as week wise for that I wrote the code like this. and i'm trying to alert the vlaue for day name after clicking the table . The time is showing correctly.only the day is showing problem like undefined. And can one guide me how to scroll horizontally this table view

var testarray = [ ];
var dayName = ["","sun","mon","tus","wen","thr","fri","sat"];
var dayTime =["12:00 A.M","1:00","2:00","3:00","4:00","5:00","6:00","7:00","8:00","9:00","10:00","11:00","12:00 PM","1:00","2:00","3:00","4:00","5:00","6:00","7:00","8:00","9:00","10:00","11:00"];
//create a row
    for(i=0; i<25; i++){
       var mainRow = Ti.UI.createTableViewRow({
        touchEnabled: true,
        left:"0",
        height: "4%",
        width: "100%",
        backgroundColor:"#EEEEEE"
      });
      var Mainlineview = Ti.UI.createView({
        backgroundColor:'#444444',    
        height:1,
        width:"100%", 
        top:"98%"
      });
 
        mainRow.add(Mainlineview);
 
 
      if (i == "0") {
 
        for(j=0; j<8; j++){
            var val = "10";
 
            var timeLabel = Ti.UI.createLabel({
                width:40,
                left:40*j,
                color:"blue",
                text : dayName[j],
 
            });
            mainRow.add(timeLabel);
        } //j for
      } 
      else{
        var settimelabel = Ti.UI.createLabel({
            left:0,
            width:60,
            text:dayTime[i]
        });
        mainRow.add(settimelabel);
        for(k=0; k<8; k++){
 
            var timeButton = Ti.UI.createButton({
                 width:40,
                 left :40*k,
                 height :20,
                 backgroundColor:"#FFFFFF",
                 borderColor:"#EEEEEE",
                 borderWidth:1
            });
 
            if(k == 0){
                timeButton.left = 40*k+70;
            }
            else{
            }
 
            mainRow.add(timeButton);
        }
      }
      testarray.push(mainRow);
    }// i for
 
    table.setData(testarray);
 
  table.addEventListener("click",function(e){
       alert("day"+e.row.children[1].text + "time"+ e.row.children[2].text);
   });

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>