DIR : /home/kozerus/public_html/pn/uize/site-source/examples/options.html

/home/kozerus/public_html/pn/uize/site-source/examples

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Options | JavaScript Examples | UIZE JavaScript Framework</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta name="keywords" content="Uize.Widget.Options"/>
	<meta name="description" content="See how to use the options widget to let the user pick a single option from a set of options by clicking on an option button. Test links are provided."/>
	<link rel="alternate" type="application/rss+xml" title="UIZE JavaScript Framework - Latest News" href="http://www.uize.com/latest-news.rss"/>
	<link rel="stylesheet" href="../css/page.css"/>
	<link rel="stylesheet" href="../css/page.example.css"/>
	<link rel="stylesheet" href="css/option-buttons-set.css"/>
</head>

<body>

<script type="text/javascript" src="../js/Uize.js"></script>

<h1 class="header">
	<a id="page-homeLink" href="../index.html" title="UIZE JavaScript Framework home"></a>
	<a href="../index.html" class="homeLinkText" title="UIZE JavaScript Framework home">UIZE JavaScript Framework</a>
</h1>

<div class="main">
	<h1 class="document-title">
		<a href="../javascript-examples.html" class="breadcrumb breadcrumbWithArrow">JAVASCRIPT EXAMPLES</a>
		Options
		<div class="pageActionsShell">
			<div id="page-actions" class="pageActions"><a href="source-code/options.html" class="buttonLink">SOURCE</a></div>
		</div>
	</h1>

	<!-- explanation copy -->

	<div class="explanation">
		<p>In this example, the markup for an options widget is being wired up by an instance of <a href="../reference/Uize.Widget.Options.html"><code>Uize.Widget.Options</code></a>. Below the options are some links that execute snippets of code to demonstrate the programmatic interface of the widget. The <code>Uize.Widget.Options</code> class provides <code>value</code> and <code>tentativeValue</code> state properties in its interface. The <code>Changed.value</code> and <code>Changed.tentativeValue</code> instance events for these two properties can be used to watch for changes in the widget's state. The <code>value</code> state property can be set to programmatically change the selected option. Interact with both the options UI and the test links to see how they affect one another.</p>
	</div>

	<!-- options UI -->

	<table class="optionsShell" cellspacing="0" cellpadding="0">
		<tr>
			<td><div id="page_options_option0" class="button">SOLAR</div></td>
			<td><div id="page_options_option1" class="button">WIND</div></td>
			<td><div id="page_options_option2" class="button">GEOTHERMAL</div></td>
			<td><div id="page_options_option3" class="button">EFFICIENCY</div></td>
			<td><div id="page_options_option4" class="button">TIDAL</div></td>
		</tr>
	</table>
	<br/>

	<!-- programmatic interface examples -->

	<div class="programmaticInterface">
		<p><b>options.get ('value') == </b> '<span id="page-optionsValue"></span>'</p>
		<p><b>options.get ('tentativeValue') == </b> '<span id="page-optionsTentativeValue"></span>'</p>
		<p>
			<b>Set the value for the options widget: </b>
			<a href="javascript://" class="linkedJs">options.set ({value:'solar'})</a>
			&nbsp;,&nbsp;
			<a href="javascript://" class="linkedJs">options.set ({value:'wind'})</a>
			&nbsp;,&nbsp;
			<a href="javascript://" class="linkedJs">options.set ({value:'geothermal'})</a>
			&nbsp;,&nbsp;
			<a href="javascript://" class="linkedJs">options.set ({value:'efficiency'})</a>
			&nbsp;,&nbsp;
			<a href="javascript://" class="linkedJs">options.set ({value:'tidal'})</a>
		</p>
	</div>
</div>

<script type="text/javascript">

Uize.require (
	[
		'UizeSite.Page.Example.library',
		'UizeSite.Page.Example',
		'Uize.Widget.Options'
	],
	function () {
		'use strict';

		/*** create the example page widget ***/
			var page = window.page = UizeSite.Page.Example ({evaluator:function (code) {eval (code)}});

		/*** add the options child widget ***/
			var options = page.addChild ('options',Uize.Widget.Options);

		/*** some code for demonstrating the widget's programmatic interface ***/
			options.wire ({
				'Changed.value':
					function () {page.setNodeInnerHtml ('optionsValue',options)},
				'Changed.tentativeValue':
					function () {page.setNodeInnerHtml ('optionsTentativeValue',options.get ('tentativeValue'))}
			});

		/*** wire up the page widget ***/
			page.wireUi ();

		/*** initialize the options widget's values ***/
			options.set ({
				values:['solar','wind','geothermal','efficiency','tidal'],
				value:'solar'
			});
	}
);

</script>

</body>
</html>

//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer