com.falkolab.radiogroup

1.1.0 • Public • Published

Radio group Widget

screenshot1

Quick Start

Get it

gitTio

Download this repository and consult the Alloy Documentation on how to install it, or simply use the gitTio CLI:

$ gittio install com.falkolab.radiogroup

Usage

First define your custom styles (see widget styles for example).

Use cases:

Example #1 - inline data source

<Widget id="radioGroup" src="com.falkolab.radiogroup" 
	items='["male", "female"]' 
 	icon="true" 
	title="false" 
 	selected="male" />

Example #2 - external data source

<Widget id="radioGroup" src="com.falkolab.radiogroup" 
	generator="radioSource" 
 	icon="true" 
	title="true" 
 	selected="2" />

Define your custom commonjs library at app/lib/radioSource.js:

module.exports = function() {
	return [
		{value: "1", title:"A"},
		{value: "2", title:"B"},
		{value: "3", title:"C"}
	];
}; 	 	

Example #3 (Alloy >= 1.3) - child tags

<Alloy module="com.falkolab.radiogroup/tags">
	<Widget id="radioGroup" src="com.falkolab.radiogroup"		
		icon="true" 
		title="true" 
		selected="blackList">			
			<Radio value="blackList" title="L('option1')"/>
			<Radio value="whiteList" title="L('option2')"/>				
	</Widget>
</Alloy>

Controller code example

View controller:

$.radioGroup.on('changed', function(evt) {
	Ti.API.info("'changed' event", JSON.stringify(evt));
	Ti.API.info("Selected value", this.getValue());
	_.delay(function(widgetCtrl) {
		Ti.API.info('Reset to default after 2 sec');
		widgetCtrl.reset();
	}, 2000, this);
});

exports.cleanup = function() {
	$.radioGroup.cleanup();
};

Give me a star if the widget was useful for you.

Package Sidebar

Install

npm i com.falkolab.radiogroup

Weekly Downloads

5

Version

1.1.0

License

MIT

Last publish

Collaborators

  • falkolab