Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-7355

Android: children[] 'undefined' for table rows within event handler

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 1.8.0.1, Release 1.8.1
    • Component/s: Android
    • Labels:
    • Environment:

      Ti SDK: tested with 1.8.0.1 and 1.8.1.v20120123161633
      V8
      Android 2.2.3 (Droid original), Android 4.0.2 (Galaxy Nexus)
      OS X 10.7.2

      Description

      Expected Results

      I should be able to read from e.row.children[] within a table's event listener. This works fine on iOS (simulator and my iPad running iOS5) and works with TiAPI 1.7.5/1.7.6 on Android.

      Actual results

      Code below throws Uncaught TypeError: Cannot set property 'text' of undefined

      var table = Ti.UI.createTableView();
      function makeRow(num) {
      	var row = Ti.UI.createTableViewRow({
      		height:60,
      		rowID: num
      	});
      	row.add(Ti.UI.createLabel({
      		font:{
      			fontWeight:'bold',
      			fontSize:16
      		},
      		left:5,
      		top: 0,
      		text:'Row '+num
      	}));
      	row.add(Ti.UI.createLabel({
      		font:{
      			fontWeight:'normal',
      			fontSize:13
      		},
      		left:5,
      		top: 35,
      		text:'Subtitle for Row '+num		
      	}));
      	return row;
      }
      for(var i=0;i<6;i++) {
      	table.appendRow(makeRow(i));
      }
      table.addEventListener('click', function(e){
      	e.row.children[1].text = 'You clicked row '+ e.index;	
      });
       
      win1.add(table);
      

        Attachments

          Activity

            People

            • Assignee:
              hpham Hieu Pham
              Reporter:
              skypanther Tim Poulsen
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-11855
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration