aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/wire/demos/markup/demo_BasicChildWire.html
blob: f5973e71d33e1c9bbc9b1f57091aa2eea0c6ab24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!--
	This file demonstrates how the dojox.wire code can be used to do declarative
	wiring of properties/attributes of some object to the properties/attributes of
	another object.  It specifically uses the Child (Composite) wire type to perform
	the mapping.

	Note that this demo expects dojo, digit, and dojox to all be peers in the same directory
	in order for it to execute.
-->
<html>
	<head>
	<title>Sample Composite (Child) Wire usage.</title>
		<style type="text/css">
			@import "../../../../dijit/themes/tundra/tundra.css";
			@import "../../../../dojo/resources/dojo.css";
			@import "../../../../dijit/tests/css/dijitTests.css";
		</style>

		<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
		<script type="text/javascript">
			dojo.require("dojo.parser");
			dojo.require("dijit.form.Button");
			dojo.require("dojo.data.ItemFileReadStore");
			dojo.require("dojox.wire.ml.Invocation");
			dojo.require("dojox.wire.ml.DataStore");
			dojo.require("dojox.wire.ml.Transfer");
			dojo.require("dojox.wire");
			dojo.require("dojox.wire.demos.WidgetRepeater");

			dataHolder = {
				request: {onItem: function(item){}},
				result: null
			};
		</script>
	</head>
	<body class="tundra">
		<!-- 
			On load of the page, invoke the fetch method of the object 'DataStore1', 
			get its parameters from the JS object 'sample.request
		-->     
		<div dojoType="dojox.wire.ml.Invocation"
			triggerEvent="onLoad"
			object="DataStore1" method="fetch" parameters="dataHolder.request">
		</div>

		<!-- 
			The store that is queried in this demo 
		-->    
		<div dojoType="dojo.data.ItemFileReadStore"
			jsId="DataStore1"
			url="countries.json">
		</div>

		<!--
			Simple container widget for creating a 'list' of some set of widgets
			As defined by the widget type it contains.
		-->
		<div dojoType="dojox.wire.demos.WidgetRepeater"
			widget="dijit.form.Button" jsId="r1">
		</div>

		<!-- 
			On the call of the onItem function of 'sample', trigger a binding/mapping of the
			item's attribute 'name' to the target object property: dataHolder.result.caption
			Then invoke the WidgetRepeater (r1)'s createNew method, using the parameters from
			dataHolder.result.
		-->  
		<div dojoType="dojox.wire.ml.Action"
			trigger="dataHolder.request" triggerEvent="onItem">
			<div dojoType="dojox.wire.ml.Transfer"
				source="arguments[0]" sourceStore="DataStore1"
				target="dataHolder.result">
				<div dojoType="dojox.wire.ml.ChildWire" name="label" attribute="name"></div>
			</div>
			<div dojoType="dojox.wire.ml.Invocation" object="r1" method="createNew" parameters='dataHolder.result'></div>
		</div>    
	</body>
</html>