Debian Codegraph @

dojox/mvc/tests/1.7/test_async-mvc_repeat-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
11 <script type="text/javascript" djConfig="parseOnLoad:0,isDebug:1,async:1" src="../../../../dojo/dojo.js"></script>
12 <script type="text/javascript">
13 /*
14
15 */
16 var model;
17 var searchRecords;
18
19 require([
20 'dojo/parser', // has to be first?
21 'dojox/mvc',
22 'dojox/mvc/Group',
23 'dojox/mvc/Repeat',
24 'dijit/form/TextBox',
25 'dijit/form/Button'], function(){
26
27 // Raw records for the master detail
28 var search_results_init =
29 {
30 "Query" : "Engineers",
31 "Results" : [
32 {
33 "First" : "Anne",
34 "Last" : "Ackerman",
35 "Location": "NY",
36 "Office" : "1S76",
37 "Email" : "[email protected]",
38 "Tel" : "123-764-8237",
39 "Fax" : "123-764-8228"
40 },
41 {
42 "First" : "Ben",
43 "Last" : "Beckham",
44 "Location": "NY",
45 "Office" : "5N47",
46 "Email" : "[email protected]",
47 "Tel" : "123-764-8599",
48 "Fax" : "123-764-8600"
49 },
50 {
51 "First" : "Chad",
52 "Last" : "Chapman",
53 "Location": "CA",
54 "Office" : "1278",
55 "Email" : "[email protected]",
56 "Tel" : "408-764-8237",
57 "Fax" : "408-764-8228"
58 },
59 {
60 "First" : "Irene",
61 "Last" : "Ira",
62 "Location": "NJ",
63 "Office" : "F09",
64 "Email" : "[email protected]",
65 "Tel" : "514-764-6532",
66 "Fax" : "514-764-7300"
67 },
68 {
69 "First" : "John",
70 "Last" : "Jacklin",
71 "Location": "CA",
72 "Office" : "6701",
73 "Email" : "[email protected]",
74 "Tel" : "408-764-1234",
75 "Fax" : "408-764-4321"
76 }
77 ]
78 };
79
80 // The dojox.mvc.StatefulModel class creates a data model instance
81 // where each leaf within the data model is decorated with dojo.Stateful
82 // properties that widgets can bind to and watch for their changes.
83 searchRecords = dojox.mvc.newStatefulModel({ data : search_results_init });
84 require([
85 'dojo/domReady!'
86 ], function(){
87 dojo.parser.parse();
88 });
89
90
91
92
93 }); // end onload
94
95 </script>
96 </head>
97 <body class="claro" style="background-image: url(images/master_detail.png)">
98 <div id="wrapper">
99 <div id="header">
100 <div id="navigation">
101 </div>
102 <div id="headerInsert">
103 <h1>Employee Search</h1>
104 <h2>Master Detail Example - With repeat container.</h2>
105 </div>
106 </div>
107 <div id="main">
108 <div id="leftNav">
109 </div>
110 <div id="mainContent">
111 <!--
112 The group container denotes some logical grouping of widgets and also serves
113 to establish a parent data binding context for its children.
114 The ref attribute for the outermost container obtains the binding from the
115 "page scope" itself.
116 -->
117 <div data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'searchRecords'">
118 <div class="row">
119 <label class="cell" for="queryInput">Search for:</label>
120 <input class="cell" id="queryInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Query'"></input>
121 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){setSearchBanner();}">Search</button>
122 </div>
123 <div class="spacer"></div>
124
125 <div id="searchBanner">Search Results for term: Engineers</div>
126
127 <!--
128 The repeat container denotes a templated UI that operates over a collection
129 of data records.
130 The UI can be customized for each iteration using properties such as
131 ${this.index} for the iteration index.
132 -->
133 <div data-dojo-type="dojox.mvc.Repeat" data-dojo-props="ref: 'Results'">
134 <div class="row" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: '${this.index}'">
135 <label class="cell" for="nameInput${this.index}">Name:</label>
136 <input class="cell" data-dojo-type="dijit.form.TextBox" id="nameInput${this.index}" data-dojo-props="ref: 'First'"></input>
137 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){setDetailsContext('${this.index}');}">Details</button>
138 </div>
139 </div>
140 <div class="spacer"></div>
141
142 <div data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: 'Results'">
143 <div id="detailsBanner">Details for result index: 0</div>
144
145 <div id="detailsGroup" data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: '0'">
146 <div class="row">
147 <label class="cell" for="firstInput">First Name:</label>
148 <input class="cell" id="firstInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'First'"></input>
149 </div>
150 <div class="row">
151 <label class="cell" for="lastInput">Last Name:</label>
152 <input class="cell" id="lastInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Last'"></input>
153 </div>
154 <!-- <div class="row">
155 <label class="cell" for="locationInput">Location:</label>
156 <input class="cell" id="locationInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Location'"></input>
157 </div>
158 -->
159 <div class="row">
160 <label class="cell" for="officeInput">Office:</label>
161 <input class="cell" id="officeInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Office'"></input>
162 </div>
163 <div class="row">
164 <label class="cell" for="emailInput">Email:</label>
165 <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Email'"></input>
166 </div>
167 <div class="row">
168 <label class="cell" for="telInput">Telephone:</label>
169 <input class="cell" id="telInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Tel'"></input>
170 </div>
171 <div class="row">
172 <label class="cell" for="faxInput">Fax:</label>
173 <input class="cell" id="faxInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="ref: 'Fax'"></input>
174 </div>
175 </div>
176 </div>
177 </div>
178 </div>
179 </div>
180 <script type="text/javascript">
181 function setDetailsContext(index) {
182 var widget = dijit.byId("detailsGroup");
183 widget.set("ref", index);
184 var detailsBanner = dojo.byId("detailsBanner");
185 detailsBanner.innerHTML = "Details for result index: " + index;
186 }
187 function setSearchBanner() {
188 var searchBanner = dojo.byId("searchBanner");
189 searchBanner.innerHTML = "Search Results for term: " + searchRecords.Query.get("value");
190 }
191 </script>
192 </body>
193 </html>