Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13317] TiAPI: Allow ListView templates outside of ListView

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTiAPI
Labelsn/a
ReporterPedro Enrique
AssigneeUnknown
Created2013-04-02T19:19:41.000+0000
Updated2018-02-28T20:04:06.000+0000

Description

It would be ideal to use the template concept for all titanium components, such as windows. For example:
var win = Ti.UI.createWindow({
	backgroundColor: 'white'
});

var template = {
	type: 'Ti.UI.ScrollView',
	bindId: 'scrollView',
	properties: {
		width: Ti.UI.FILL,
		height: Ti.UI.SIZE,
		layout: 'vertical'
	},
	childTemplates: [
		{
			type: 'Ti.UI.Button',
			bindId: 'last_button',
			properties: {
				title: 'Button 11',
				height: Ti.UI.SIZE,
				left: 20,
				right: 20,
				top: 10
			},
			events: {
				'click': onClick
			}
		}
	]
};

win.addFromTemplate(template);

var scrollView = win.getViewFromBindId('scrollView');

function onClick(e) {
	scrollView.backgroundColor = 'red';
}

win.open();

Comments

  1. Pedro Enrique 2013-04-02

    PR: https://github.com/appcelerator/titanium_mobile/pull/4065
  2. Ingo Muschenetz 2014-03-04

    We will revisit this at a later point when there is significant customer requests.

JSON Source