Debian Codegraph @

dojox/mvc/tests/1.7/test_mvc_shipto-billto-simple.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 <style type="text/css">
7 @import "css/app-format.css";
8 @import "../../../../dijit/themes/claro/claro.css";
9 </style>
10 <script type="text/javascript" djConfig="parseOnLoad:1,isDebug:1,async:1" src="../../../../dojo/dojo.js"></script>
11 <script type="text/javascript">
12 var model;
13
14 require([
15 'dojo/parser',
16 'dojo/ready',
17 'dojox/mvc',
18 'dijit/form/TextBox',
19 'dijit/form/Button',
20 'dojox/mvc/Group',
21 'dojox/mvc/Output'
22 ], function(parser, ready, mvc){
23
24 // Initial data
25 var order = {
26 "Serial" : "360324",
27 "First" : "John",
28 "Last" : "Doe",
29 "Email" : "[email protected]",
30 "ShipTo" : {
31 "Street" : "123 Valley Rd",
32 "City" : "Katonah",
33 "State" : "NY",
34 "Zip" : "10536"
35 },
36 "BillTo" : {
37 "Street" : "17 Skyline Dr",
38 "City" : "Hawthorne",
39 "State" : "NY",
40 "Zip" : "10532"
41 }
42 };
43 // The dojox.mvc.StatefulModel class creates a data model instance
44 // where each leaf within the data model is decorated with dojo.Stateful
45 // properties that widgets can bind to and watch for their changes.
46 model = mvc.newStatefulModel({ data : order });
47 // the StatefulModel created above is initialized with
48 // model.First set to "John", model.Last set to "Doe" and model.Email set to "[email protected]"
49
50 });
51
52 // setRef is call when the "Ship To" or "Bill To" button is pressed.
53 function setRef(id, addrRef) {
54 var widget = dijit.byId(id);
55 widget.set("ref", addrRef);
56 }
57 </script>
58
59
60 </head>
61 <body class="claro">
62 <div id="wrapper">
63 <div id="header">
64 <div id="navigation">
65 </div>
66 <div id="headerInsert">
67 <h1>Order Shipping Details</h1>
68 <h2>Data Binding Example - Group Container.</h2>
69 </div>
70 </div>
71 <div id="main">
72 <div id="leftNav"></div>
73 <div id="mainContent">
74 <!--
75 The group container denotes some logical grouping of widgets and also serves
76 to establish a parent data binding context for its children.
77 The ref attribute for the outermost container obtains the binding from the
78 "page scope" itself.
79 -->
80 <div class="row" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'model'">
81 <div class="row">
82 <label class="cell" for="serialInput">Order #:</label>
83 <input class="cell" id="serialInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Serial'"/>
84 </div>
85 <div class="row">
86 <label class="cell" for="lastnameInput">Last:</label>
87 <input class="cell" id="lastnameInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Last'"/>
88 </div>
89 <div class="row">
90 <label class="cell" for="emailInput">Email:</label>
91 <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Email'"/>
92 </div>
93 </div>
94 <br/>
95 Choose:
96 <button id="shipto" type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){setRef('addrGroup', model.ShipTo);}">Ship To</button>
97 <button id="billto" type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){setRef('addrGroup', model.BillTo);}">Bill To</button>
98 <br/>
99 <!--
100 For convenience, the widget hierarchy matches the data hierarchy
101 (see JSON literal above).
102 In this implementation, the child ref attributes are simple property names
103 of the parent binding context.
104 The ref attribute may support more advanced constructs, such as queries
105 over the parent widget's or other application specified binding context.
106 -->
107 <div class="row" id="addrGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'model.ShipTo'">
108 <div class="row">
109 <label class="cell" for="streetInput">Street:</label>
110 <input class="cell" id="streetInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Street'"/>
111 </div>
112 <div class="row">
113 <label class="cell" for="cityInput">City:</label>
114 <input class="cell" id="cityInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'City'"/>
115 </div>
116 <div class="row">
117 <label class="cell" for="stateInput">State:</label>
118 <input class="cell" id="stateInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'State'"/>
119 </div>
120 <div class="row">
121 <label class="cell" for="zipInput">Zipcode:</label>
122 <input class="cell" id="zipInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Zip'"/>
123 </div>
124 </div>
125 <br/>
126 Model:
127 <button id="reset" type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){model.reset();}">Reset</button>
128 </div></div></div>
129 </body>
130 </html>