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

ScrollableView in ListView's items, causes a bug after the scroll of any ScrollableView

    Details

      Description

      Problem description
      If you use a ScrollableView in a ListView, it has a bug.
      By default, in every item I show the first image of ScrollableView (currentPage = 0). After the scroll in any one of ScrollableViews, if then I scroll the ListView, many other ScrollableViews will have changed the image. Even if I try to reload the ListView, it will not show the first image of ScrollableView in all items.

      Test case
      This is a generic code that reproduces the problem:

       
      var win = Ti.UI.createWindow();
      var remoteImages = true; // false for localImages
       
      //--> UI ELEMENTS
      //	-> ListView Template
      var itemTemplate = {
          childTemplates: [
              {
                  type: 'Ti.UI.View',  
                  bindId: 'bgView',  
                  properties: { 
      				width : "100%",
      				height : "100%",
      				backgroundColor : "#aabbcc",
      				zIndex : 1    
                  }       	
              },
              {
                  type: 'Ti.UI.ScrollableView',  
                  bindId: 'imagesSV',  
                  properties: {
      				width : "100%",
      				height : "210dp",
      				showPagingControl : true,
      				currentPage : 0,
      				zIndex : 2
                  }
      		}
      	]
      };
       
      var itemsLV = Ti.UI.createListView({
      		top : "50dp",
      		bottom : "0dp",
      		templates : {'itemTemplate': itemTemplate},
      		defaultItemTemplate : 'itemTemplate',
      		backgroundColor : "transparent",
      		separatorColor : "transparent"
      });	
       
       
      var reloadBtn = Ti.UI.createButton({
      	title : "Reload",
      	top : "5dp"
      });
      reloadBtn.addEventListener("click", function(){
      	reload();
      });
       
      var loadingAI = Ti.UI.createActivityIndicator();
      	
      var reload = function(){
      	
      	itemsLV.visible = false;
      	itemsLV.sections = [];
      	loadingAI.show();
      	
      	var data = [];
      	for(var j=0; j<100; j++){
       
      		var images = [];
      		if(remoteImages){
      			var imagesUrl = [
      				"https://si0.twimg.com/profile_images/3170725828/ac1d6621fc3c3ecaa541d8073d4421cc.jpeg",
      				"http://blogs.dallasobserver.com/sportatorium/No.%202.png",
      				"http://dt1lqdui5w8vj.cloudfront.net/9/images/badge3.png",
      				"http://www.tanialuiz.com/tania/images/stories/virtuemart/product/661dd600899aee2c6b69060aabcf54ab.png",
      				"https://si0.twimg.com/profile_images/2797666136/a7030f51e405cde3684cb7bc46107736.png",
      				"http://www.i2symbol.com/images/symbols/style-digits/circled_digit_six_u2465_icon_256x256.png"
      			];
      		}else{
      			var imagesUrl = [
      				"/KS_nav_views.png",
      				"/KS_nav_ui.png",
      				"/KS_nav_views.png",
      				"/KS_nav_ui.png",
      				"/KS_nav_views.png",
      				"/KS_nav_ui.png"
      			];			
      		};
      		
      		for(var i in imagesUrl){
      			images.push(Ti.UI.createImageView({
      				image : imagesUrl[i],
      				defaultImage : "/KS_nav_views.png"
      			}));
      		};
      		
      	    data.push({
      	        properties : {
      	            itemId: 'image n. ' + (i + 1),
      	            accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE,
      				selectionStyle : Ti.UI.iPhone.ListViewCellSelectionStyle.NONE,
      				height : "210dp"
      	        },
      	        bgView : {},
      	        imagesSV :{
      	        	views : images,
      	        	currentPage : 0
             		}
      	    });
      	 };	
      	
          var section = Ti.UI.createListSection({items: data});
          itemsLV.sections = [section];
          itemsLV.visible = true;
          loadingAI.hide();	
      };
      reload();
       
      //--> ADD TO WIN
      win.add(reloadBtn);
      win.add(itemsLV);
      win.add(loadingAI);
       
      win.open();
      

        Attachments

          Activity

            People

            • Assignee:
              vduggal Vishal Duggal (Inactive)
              Reporter:
              astrovicapps Vittorio Sorbera
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code