Titanium JIRA Archive
Alloy (ALOY)

[ALOY-614] Dynamic DataCollection for UI

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsRuntime, XML
Labelsn/a
ReporterShak Hossain
AssigneeUnknown
Created2013-04-09T15:07:26.000+0000
Updated2018-03-07T22:25:48.000+0000

Description

Problem

Would like to be able to dynamically set the dataCollection for a UI element. In this way we can use a single view/controller to output a different collection of data.

Test case

var tab = null;

exports.openMainWindow = function(_tab,_title,_collection){
	tab = _tab;
	$.win.title = _title;
	var collection = Alloy.Collections[_collection];
	collection.fetch();
	$.tab.dataCollection = collection;
	_tab.open($.win);
}

var goNext = function(e){
	if(e.source.custom.length>0){
		var subControl = Alloy.createController(e.source.custom);
	} else if(e.source.nextCollection.length>0) {
		var subControl = Alloy.createController('table');
		subControl.openMainWindow(tab,e.source.title,e.source.nextCollection);
	}
	
}

$.tab.addEventListener('click', goNext);

Discussions

http://developer.appcelerator.com/question/150685/dynamic-collection-for-view#comment-167341

Comments

No comments

JSON Source