jasonkneen
5/15/2014 - 2:45 PM

Demonstrate CollapsableView Tag in Alloy.

Demonstrate CollapsableView Tag in Alloy.

// put in the lib folder

exports.createCollapsableView = function(args) {
	var view = Ti.UI.createView(args);

	view.collapse = function() {
		
		view.expandedHeight = view.expandedHeight || view.height;
		view.height = 0;
	};

	view.expand = function() {
		view.height = view.expandedHeight;
	};

	return view;
};
<Alloy>
	<CollapsableView module="ui" id="myView" height="200" width="Ti.UI.FILL" layout="vertical">
		<Label top="20">Hello there</Label>
		<Button top="20" onClick="collapse">Collapse Me</Button>
	</CollapsableView>
</Alloy>
function collapse(){
	$.myView.collapse();
	// $.myView.expand();
}