Debian Codegraph @

dojox/mvc/tests/1.7/test_mvc_shipto-billto-hierarchical.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5 <title>Static Master/Detail Pattern -- Multiple Address Detail example</title>
6
7 <script src="../../../../dojo/dojo.js"
8 type="text/javascript"
9 djConfig="parseOnLoad: true, isDebug: true">
10 </script>
11 <style type="text/css">
12 @import "css/app-format.css";
13 @import "../../../../dijit/themes/claro/claro.css";
14 </style>
15 <script type="text/javascript" >
16 dojo.require("dojox.mvc");
17 dojo.require("dojox.mvc.Group");
18 dojo.require("dijit.form.TextBox");
19 dojo.require("dijit.form.Button");
20 dojo.require("dojo.parser");
21
22 // Initial data with a noticeable hierarchy
23 var order = {
24 "Serial" : "360324",
25 "First" : "John",
26 "Last" : "Doe",
27 "Email" : "[email protected]",
28 "ShipTo" : {
29 "Type" : "Home",
30 "Address" : {
31 "Street" : "123 Valley Rd",
32 "City" : "Katonah",
33 "State" : "NY",
34 "Zip" : "10536"
35 },
36 "Telephone" : {
37 "AreaCode" : "123",
38 "Landline" : {
39 "Number" : "456-7890",
40 "Extension" : "42"
41 },
42 "Cell" : {
43 "Number" : "765-4321"
44 }
45 }
46 },
47 "BillTo" : {
48 "Type" : "Office",
49 "Address" : {
50 "Street" : "17 Skyline Dr",
51 "City" : "Hawthorne",
52 "State" : "NY",
53 "Zip" : "10532"
54 },
55 "Telephone" : {
56 "AreaCode" : "098",
57 "Landline" : {
58 "Number" : "765-4321",
59 "Extension" : "24"
60 },
61 "Cell" : {
62 "Number" : "123-4567"
63 }
64 }
65 }
66 };
67
68 // The dojox.mvc.StatefulModel class creates a data model instance
69 // where each leaf within the data model is decorated with dojo.Stateful
70 // properties that widgets can bind to and watch for their changes.
71 var model = dojox.mvc.newStatefulModel({ data : order });
72 var selectedAddr = dojox.mvc.newStatefulModel({ data : "ShipTo" });
73 </script>
74 </head>
75 <body class="claro">
76 <div id="wrapper">
77 <div id="header">
78 <div id="navigation">
79 </div>
80 <div id="headerInsert">
81 <h1>Order Shipping Details</h1>
82 <h2>Data Binding Example - Hierarchical data.</h2>
83 </div>
84 </div>
85 <div id="main">
86 <div id="leftNav">
87 </div>
88 <div id="mainContent">
89 <!--
90 The group container denotes some logical grouping of widgets and also serves
91 to establish a parent data binding context for its children.
92 The ref attribute for the outermost container obtains the binding from the
93 "page scope" itself.
94 -->
95 <div class="row" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'model'">
96 <div class="row">
97 <label class="cell" for="serialInput">Order #:</label>
98 <input class="cell" id="serialInput" data-dojo-type="dijit.form.TextBox"
99 data-dojo-props="ref: 'Serial'"/>
100 </div>
101 <div class="row">
102 <label class="cell" for="lastnameInput">Last name:</label>
103 <input class="cell" id="lastnameInput" data-dojo-type="dijit.form.TextBox"
104 data-dojo-props="ref: 'Last'"/>
105 </div>
106 <div class="row">
107 <label class="cell" for="emailInput">Email:</label>
108 <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox"
109 data-dojo-props="ref: 'Email'"/>
110 </div>
111 </div>
112 <br/>
113 Choose:
114 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){setRef('addrGroup', 'model.ShipTo');}">Ship To</button>
115 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){setRef('addrGroup', 'model.BillTo');}">Bill To</button>
116 <br/>
117 <div class="row">
118 <label class="cell" for="addrLabel">Selected Address:</label>
119 <input class="cell" data-dojo-type="dijit.form.TextBox" id="addrLabel"
120 data-dojo-props="ref: 'selectedAddr'"/>
121 </div>
122 <br/>
123 <!--
124 For convenience, the widget hierarchy matches the data hierarchy
125 (see JSON literal above).
126 In this implementation, the child ref attributes are simple property names
127 of the parent binding context.
128 The ref attribute may support more advanced constructs, such as queries
129 over the parent widget's or other application specified binding context.
130 -->
131 <div id="addrGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'model.ShipTo'">
132 <div class="row">
133 <label class="cell" for="typeInput">Type:</label>
134 <input class="cell" id="typeInput" data-dojo-type="dijit.form.TextBox"
135 data-dojo-props="ref: 'Type'"/>
136 </div>
137 <div id="postalGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'Address'">
138 <div class="row">
139 <label class="cell" for="streetInput">Street:</label>
140 <input class="cell" id="streetInput" data-dojo-type="dijit.form.TextBox"
141 data-dojo-props="ref: 'Street'"/>
142 </div>
143 <div class="row">
144 <label class="cell" for="cityInput">City:</label>
145 <input class="cell" id="cityInput" data-dojo-type="dijit.form.TextBox"
146 data-dojo-props="ref: 'City'"/>
147 </div>
148 <div class="row">
149 <label class="cell" for="stateInput">State:</label>
150 <input class="cell" id="stateInput" data-dojo-type="dijit.form.TextBox"
151 data-dojo-props="ref: 'State'"/>
152 </div>
153 <div class="row">
154 <label class="cell" for="zipInput">Zipcode:</label>
155 <input class="cell" id="zipInput" data-dojo-type="dijit.form.TextBox"
156 data-dojo-props="ref: 'Zip'"/>
157 </div>
158 </div>
159 <div id="telGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'Telephone'">
160 <div class="row">
161 <label class="cell" for="areacodeInput">Area code:</label>
162 <input class="cell" id="areacodeInput" data-dojo-type="dijit.form.TextBox"
163 data-dojo-props="ref: 'AreaCode'"/>
164 </div>
165 <div id="llGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'Landline'">
166 <div class="row">
167 <label class="cell" for="numberInput">Landline Number:</label>
168 <input class="cell" id="numberInput" data-dojo-type="dijit.form.TextBox"
169 data-dojo-props="ref: 'Number'"/>
170 </div>
171 <div class="row">
172 <label class="cell" for="extInput">Extension:</label>
173 <input class="cell" id="extInput" data-dojo-type="dijit.form.TextBox"
174 data-dojo-props="ref: 'Extension'"/>
175 </div>
176 </div>
177 <div class="row" id="cellGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'Cell'">
178 <label class="cell" for="cellInput">Cell Number:</label>
179 <input class="cell" id="cellInput" data-dojo-type="dijit.form.TextBox"
180 data-dojo-props="ref: 'Number'"/>
181 </div>
182 </div>
183 <br/>
184 Model:
185 <button id="reset" type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){model.reset();}">Reset</button>
186 </div></div></div>
187 <script type="text/javascript">
188 function setRef(id, addrRef) {
189 var widget = dijit.byId(id);
190 widget.set("ref", addrRef);
191 if(addrRef == "model.ShipTo")
192 selectedAddr.set("value", "ShipTo");
193 else
194 selectedAddr.set("value", "BillTo");
195 }
196 </script>
197 </body>
198 </html>