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

Android: Image in table row doesn't change or changes on a wrong row

    Details

      Description

      Problem description
      A table with 2 table view sections, each section contains some rows, in each row there's a label and image view. When the user clicks on the image, the image should change to another one, and when the user clicks on the row it should change back. This causes 2 problems on Android only:

      1. If user keep click on selection 1 row image and then click on selection 2 same row image, the table will start to to act incorrectly (click on selection1 image row will change selection2 same row image).
      2. Sometimes when user click on the row, the image doesn't change back.

      Steps to reproduce
      Just keep tapping on these two section rows or images, you will see the problem.

      Test case

      var win1 = Titanium.UI.createWindow({
      	title : 'Tab 1',
      	backgroundColor : '#fff'
      });
       
      var tableView = Titanium.UI.createTableView();
       
      tableView.addEventListener("click", function(e) {
      	if (e.source.sw) {
      		e.row.children[1].image = '/KS_nav_views.png'
      	} else {
      		e.row.children[1].image = '/KS_nav_ui.png'
      	}
      	tableView.setData(tableView.getData());
      	//why I have to do this, in order to show the change
      });
       
      if (Ti.Platform.osname === 'iphone')
      	tableView.style = Ti.UI.iPhone.TableViewStyle.GROUPED;
       
      var tvs = [];
      //------------------------------- tvs1
      tvs[0] = Ti.UI.createTableViewSection({
      	headerTitle : 'Selection 1'
      });
      //------------------------------- tvs2
      tvs[1] = Ti.UI.createTableViewSection({
      	headerTitle : 'Selection 2'
      });
       
      for ( i = 0; i < 2; i++) {
      	for ( j = 0; j < 3; j++) {
      		var label = Ti.UI.createLabel({
      			left : 8,
      			text : "Label " + j
      		});
       
      		var imgSw = Ti.UI.createImageView({
      			right : 2,
      			height : 48,
      			width : 48,
      			image : '/KS_nav_ui.png',
      			sw : true
      		});
       
      		var row = Ti.UI.createTableViewRow({
      			height : 48,
      			className : 'row'
      		});
       
      		row.add(label);
      		row.add(imgSw);
      		tvs[i].add(row);
      	}
      }
       
      tableView.setData(tvs);
      win1.add(tableView);
      win1.open(); 
      

        Attachments

          Activity

            People

            • Assignee:
              mstepanov Max Stepanov
              Reporter:
              jt JackieTai
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Integration