Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-23646] Android: Fix ListView template 'click' event data #8729

Merged
merged 2 commits into from Apr 19, 2017

Conversation

garymathews
Copy link
Contributor

  • Append ListView template item properties to the source property
TEST CASE
var win = Ti.UI.createWindow(),
	items = [],
	template = {
		properties: {
			accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE,
			backgroundColor: 'white',
			height: Ti.UI.SIZE,
			layout: 'horizontal'
		},
		events: {
			click: function(e) {
				alert(e.source.customProperty);
			}
		},
		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'
				}
			}
		]
	},
	listView = Ti.UI.createListView({templates: {'template': template}}),
	section = Ti.UI.createListSection();

for(var i = 1; i <= 10; i++){
	items.push({
		template: 'template',
		bindButton: {
		   title: 'A ' + i,
		   customProperty: i
		},
		bindButton2: {
		   title: 'B ' + i,
		   customProperty: i
		},
		properties: {
		   itemId: i
		}
	});
}

section.setItems(items);
listView.sections = [section];

win.add(listView);
win.open();

JIRA Ticket

@lokeshchdhry lokeshchdhry self-assigned this Apr 19, 2017
@lokeshchdhry
Copy link
Contributor

FR Passed.

ListView template click event data is returned as expected.

Environment:
Studio Ver : 4.8.1.201612050850
SDK Ver : 6.2.0 local build
OS Ver : 10.12.3
Xcode Ver : Xcode 8.3.1
Appc NPM : 4.2.9
Appc CLI : 6.2.0
Ti CLI Ver : 5.0.12
Alloy Ver : 1.9.11
Node Ver : 6.10.1
Java Ver : 1.8.0_101
Devices : google Nexus 6P --- Android 7.1.1
google Nexus 6 --- Android 6.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants