Debian Codegraph @

dojox/wire/demos/markup/demo_BasicChildWire.html

raw symbols SCIP
1 <!--
2 This file demonstrates how the dojox.wire code can be used to do declarative
3 wiring of properties/attributes of some object to the properties/attributes of
4 another object. It specifically uses the Child (Composite) wire type to perform
5 the mapping.
6
7 Note that this demo expects dojo, digit, and dojox to all be peers in the same directory
8 in order for it to execute.
9 -->
10 <html>
11 <head>
12 <title>Sample Composite (Child) Wire usage.</title>
13 <style type="text/css">
14 @import "../../../../dijit/themes/tundra/tundra.css";
15 @import "../../../../dojo/resources/dojo.css";
16 @import "../../../../dijit/tests/css/dijitTests.css";
17 </style>
18
19 <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true"></script>
20 <script type="text/javascript">
21 dojo.require("dojo.parser");
22 dojo.require("dijit.form.Button");
23 dojo.require("dojo.data.ItemFileReadStore");
24 dojo.require("dojox.wire.ml.Invocation");
25 dojo.require("dojox.wire.ml.DataStore");
26 dojo.require("dojox.wire.ml.Transfer");
27 dojo.require("dojox.wire");
28 dojo.require("dojox.wire.demos.WidgetRepeater");
29
30 dataHolder = {
31 request: {onItem: function(item){}},
32 result: null
33 };
34 </script>
35 </head>
36 <body class="tundra">
37 <!--
38 On load of the page, invoke the fetch method of the object 'DataStore1',
39 get its parameters from the JS object 'sample.request
40 -->
41 <div dojoType="dojox.wire.ml.Invocation"
42 triggerEvent="onLoad"
43 object="DataStore1" method="fetch" parameters="dataHolder.request">
44 </div>
45
46 <!--
47 The store that is queried in this demo
48 -->
49 <div dojoType="dojo.data.ItemFileReadStore"
50 data-dojo-id="DataStore1"
51 url="countries.json">
52 </div>
53
54 <!--
55 Simple container widget for creating a 'list' of some set of widgets
56 As defined by the widget type it contains.
57 -->
58 <div dojoType="dojox.wire.demos.WidgetRepeater"
59 widget="dijit.form.Button" data-dojo-id="r1">
60 </div>
61
62 <!--
63 On the call of the onItem function of 'sample', trigger a binding/mapping of the
64 item's attribute 'name' to the target object property: dataHolder.result.caption
65 Then invoke the WidgetRepeater (r1)'s createNew method, using the parameters from
66 dataHolder.result.
67 -->
68 <div dojoType="dojox.wire.ml.Action"
69 trigger="dataHolder.request" triggerEvent="onItem">
70 <div dojoType="dojox.wire.ml.Transfer"
71 source="arguments[0]" sourceStore="DataStore1"
72 target="dataHolder.result">
73 <div dojoType="dojox.wire.ml.ChildWire" name="label" attribute="name"></div>
74 </div>
75 <div dojoType="dojox.wire.ml.Invocation" object="r1" method="createNew" parameters='dataHolder.result'></div>
76 </div>
77 </body>
78 </html>