Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23646] Android: Button source missing properties on bubbleParent event.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-04-20T17:46:45.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsandroid, bubbleParent, button, events, listview, merge-6.1.0
ReporterLorenzo Piccinini
AssigneeGary Mathews
Created2016-07-03T09:02:50.000+0000
Updated2017-05-16T18:19:42.000+0000

Description

I have listview with button inside the items. I have set a click event function but it don't return custom button's properties. In iOS it works fine.
var item = {
    properties : {
        accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE,
        backgroundColor: '#fff',
        width: Ti.UI.FILL,
        height : Ti.UI.SIZE
    },
    events: {
       click: eventFunction
    },
    childTemplates : [
    {
        type : 'Ti.UI.Button',
        bindId : 'bindButton',
        properties : {
            width: 70,
            height: 70,
            image: "/images/user_icon.png",
            borderRadius: 35,
            borderWidth: 1,
            borderColor: '#dedede',
            zIndex: 1,
            backgroundColor: 'transparent',
            customProperty1 : 10,
            customProperty2 : 10
        },
    },
   {
        type : 'Ti.UI.Button',
        bindId : 'bindButton2',
        properties : {
            width: 70,
            height: 70,
            image: "/images/user_icon.png",
            borderRadius: 35,
            borderWidth: 1,
            borderColor: '#dedede',
            zIndex: 1,
            backgroundColor: 'transparent',
            customProperty1 : 20,
            customProperty2 : 20
        }
    }
 ]
 }

function eventFunction(e){
    var customProperty1 = e.source.customProperty1;
};
When I click on button in eventFunction I expect to find e.source.customProperty1 but e.source don't contain it. Why? In iOS I find the properties as expected. I have tried moving events param inside the button template but the result is the same. Is it a bug?

Comments

  1. Sharif AbuDarda 2016-07-16

    Hello, We need a full reproducible code.
  2. Lorenzo Piccinini 2016-07-19

    Copy and paste in your app.js. Look the difference between iOS and Android by clicking on buttons. In android you will not get customProperty by click event.
       	var self = Ti.UI.createWindow();
       	
       	var items = [];
       	
       	var template = {
       	    properties : {
       	        accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE,
       	        backgroundColor: '#fff',
       	        height: Ti.UI.SIZE,
       	        layout: 'horizontal'
       	    },
       	    events: {
       	       click: eventFunction
       	    },
       	    childTemplates :
       	    [
       		    {
       		        type : 'Ti.UI.Button',
       		        bindId : 'bindButton',
       		        properties : {
       		        	left: 10,
       		            width: 100,
       		            height: 40,
       		            borderRadius: 20,
       		            borderWidth: 1,
       		            borderColor: '#dedede',
       		            backgroundColor: 'green'
       		        },
       		    },
       			{
       		        type : 'Ti.UI.Button',
       		        bindId : 'bindButton2',
       		        properties : {
       		        	right: 10,
       		            width: 100,
       		            height: 40,
       		            borderRadius: 20,
       		            borderWidth: 1,
       		            borderColor: '#dedede',
       		            backgroundColor: 'red'
       		        }
       		    }
       		]
       	};
       	
       	var listview = Ti.UI.createListView({templates: {'template': template}});
       	var section = Ti.UI.createListSection();
       	
       	for(var i=1; i<=10; i++){
       		
       		var item = { 
       	        template : 'template',
       	        bindButton : {
       	        	title: 'button a ' + i,
       	        	customProperty : i
       	        },
       	        bindButton2 : {
       	        	title: 'button b ' + i,
       	        	customProperty : i
       	        },
       	        properties: {
       	            itemId: i
       	        }
       	    };
       	    
       		
       		
       		items.push(item);
       	
       	}
       	
       	
       	section.setItems(items);
       	listview.sections = [section];
       	
       	self.add(listview);
       	 
       	function eventFunction(e){
       	    //var customProperty1 = e.source.customProperty1;
       	    alert(JSON.stringify(e.source));
       	};
       	
       	self.open();
       
       
  3. Lorenzo Piccinini 2016-07-28

    Any news about it? I think it is important bug.
  4. Lorenzo Piccinini 2016-11-06

    Is there any news about this problem ?
  5. Gary Mathews 2016-11-08

    This could potentially be fixed by https://github.com/appcelerator/titanium_mobile/pull/8557
  6. Chee Kiat Ng 2016-11-30

    Just tested the sample code on ti sdk 6.1.0.v20161129163215 but the problem still persist. it's not fixed by that PR.
  7. Lorenzo Piccinini 2017-01-03

    Is there any news about this problem ? I don't know how to solve this problem! Is there any work around? I don't how it is possibile, I think is a basic functionality to manage interactive listview.
  8. Gary Mathews 2017-01-05

    master: https://github.com/appcelerator/titanium_mobile/pull/8729
  9. Lokesh Choudhary 2017-04-19

    FR passed. Master PR merged. [~gmathews], waiting for 6.1.0 backport.
  10. Gary Mathews 2017-05-09

    [~lchoudhary] 6_1_X: https://github.com/appcelerator/titanium_mobile/pull/9035
  11. Lokesh Choudhary 2017-05-09

    FR Passed for backport.
  12. Abir Mukherjee 2017-05-16

    Closing this ticket. The changes are seen in these builds, installed from the CLI: 6.1.0.v20170516103606 6.2.0.v20170515114643

JSON Source