Debian Codegraph @

dojox/mvc/tests/doh/doh_mvc_DOMNode-search-results-repeat.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>MVC DOH Search Results Repeat Test</title>
6 <style>
7 @import "../../../../dojo/resources/dojo.css";
8 @import "../css/app-format.css";
9 </style>
10 <script src="../../../../dojo/dojo.js" type="text/javascript" data-dojo-config="isDebug: true, mvc: {debugBindings: true}"></script>
11 <script type="text/javascript" src="./helpers.js"></script>
12 <script type="text/javascript">
13
14 require([
15 "doh/runner",
16 "dojo/parser",
17 "dijit/registry",
18 "dojo/dom",
19 "dojo/when",
20 "dojox/mvc/getStateful",
21 "dojox/mvc/_atBindingExtension",
22 "dojox/mvc/ListController",
23 "dojox/mvc/StatefulArray",
24 "dojox/mvc/Group",
25 "dojox/mvc/Output",
26 "dojox/mvc/Repeat",
27 "dojox/mvc/parserExtension",
28 "dojo/domReady!"
29 ], function(doh, parser, registry, dom, when, getStateful){
30 function runTests(){
31 // should be able to verify all of the inputs
32 doh.register("Check initial values and bindings", [
33 {
34 name: "initial",
35 runTest: function(){
36 var name1, bind1, firstInput;
37 name1 = dom.byId("nameInput0");
38 if (name1) {
39 doh.is("Anne",name1.value,"name1.value should be set");
40 }
41
42 firstInput = dom.byId("firstInput");
43 if (firstInput) {
44 doh.is("Anne",firstInput.value,"firstInput.value should be set");
45 }
46 }
47 }
48 ]);
49
50 doh.register("select Ben", [
51 {
52 name: "testBen",
53 runTest: function(){
54 setDetailsContext(1);
55 var name1, bind1, firstInput;
56 name1 = dom.byId("nameInput1");
57 if (name1) {
58 doh.is("Ben",name1.value,"name1.value is wrong");
59 }
60
61 firstInput = registry.byId("firstInput");
62 if (firstInput) {
63 doh.is("Ben",firstInput.value,"firstInput value is wrong");
64 firstInput.set("value","Benjamin");
65 doh.is("Benjamin",firstInput.value,"firstInput value is wrong after update");
66 doh.is("Benjamin",name1.value,"name1.get(value) is wrong after update");
67 }
68 }
69 }
70 ]);
71
72 doh.run();
73 }
74
75 setDetailsContext = function(index){
76 var ctl = registry.byId("listCtl");
77 ctl.set("cursorIndex", index);
78 };
79
80 searchRecords = getStateful(
81 {
82 "Query" : "Engineers",
83 "Results" : [
84 {
85 "First" : "Anne",
86 "Last" : "Ackerman",
87 "Location": "NY",
88 "Office" : "1S76",
89 "Email" : "[email protected]",
90 "Tel" : "123-764-8237",
91 "Fax" : "123-764-8228"
92 },
93 {
94 "First" : "Ben",
95 "Last" : "Beckham",
96 "Location": "NY",
97 "Office" : "5N47",
98 "Email" : "[email protected]",
99 "Tel" : "123-764-8599",
100 "Fax" : "123-764-8600"
101 },
102 {
103 "First" : "Chad",
104 "Last" : "Chapman",
105 "Location": "CA",
106 "Office" : "1278",
107 "Email" : "[email protected]",
108 "Tel" : "408-764-8237",
109 "Fax" : "408-764-8228"
110 },
111 {
112 "First" : "David",
113 "Last" : "Durham",
114 "Location": "NJ",
115 "Office" : "C12",
116 "Email" : "[email protected]",
117 "Tel" : "514-764-8237",
118 "Fax" : "514-764-8228"
119 },
120 {
121 "First" : "Emma",
122 "Last" : "Eklof",
123 "Location": "NY",
124 "Office" : "4N76",
125 "Email" : "[email protected]",
126 "Tel" : "123-764-1234",
127 "Fax" : "123-764-4321"
128 },
129 {
130 "First" : "Fred",
131 "Last" : "Fisher",
132 "Location": "NJ",
133 "Office" : "V89",
134 "Email" : "[email protected]",
135 "Tel" : "514-764-8567",
136 "Fax" : "514-764-8000"
137 },
138 {
139 "First" : "George",
140 "Last" : "Garnett",
141 "Location": "NY",
142 "Office" : "7S11",
143 "Email" : "[email protected]",
144 "Tel" : "123-999-8599",
145 "Fax" : "123-999-8600"
146 },
147 {
148 "First" : "Hunter",
149 "Last" : "Huffman",
150 "Location": "CA",
151 "Office" : "6532",
152 "Email" : "[email protected]",
153 "Tel" : "408-874-8237",
154 "Fax" : "408-874-8228"
155 },
156 {
157 "First" : "Irene",
158 "Last" : "Ira",
159 "Location": "NJ",
160 "Office" : "F09",
161 "Email" : "[email protected]",
162 "Tel" : "514-764-6532",
163 "Fax" : "514-764-7300"
164 },
165 {
166 "First" : "John",
167 "Last" : "Jacklin",
168 "Location": "CA",
169 "Office" : "6701",
170 "Email" : "[email protected]",
171 "Tel" : "408-764-1234",
172 "Fax" : "408-764-4321"
173 }
174 ]
175 });
176
177 when(parser.parse(), function(){
178 registry.byId("listCtl").set("model", searchRecords.Results);
179 runTests();
180 });
181 });
182 </script>
183 </head>
184 <body class="claro" style="width:100%;height:100%;margin:0;padding:0;">
185 <script type="dojo/require">at: "dojox/mvc/at"</script>
186 <span id="listCtl" data-dojo-type="dojox.mvc.ListController"
187 data-dojo-props="cursorIndex: 0"></span>
188 <div id="header">
189 <div id="navigation">
190 </div>
191 <div id="headerInsert">
192 <h1>Employee Search</h1>
193 <h2>Master Detail Example - With repeat container.</h2>
194 </div>
195 </div>
196 <div id="main">
197 <div id="leftNav">
198 </div>
199 <div id="mainContent">
200 <!--
201 The group container denotes some logical grouping of widgets and also serves
202 to establish a parent data binding context for its children.
203 The target attribute for the outermost container obtains the binding from the
204 "page scope" itself.
205 -->
206 <div>
207 <div id="searchBanner">Search Results for term: Engineers</div>
208
209 <!--
210 The repeat container denotes a templated UI that operates over a collection
211 of data records.
212 The UI can be customized for each iteration using properties such as
213 ${this.index} for the iteration index.
214 -->
215 <div data-dojo-type="dojox.mvc.Repeat"
216 data-dojo-props="children: at('widget:listCtl', 'model')">
217 <div class="row" data-dojo-type="dojox.mvc.Group"
218 data-dojo-props="target: at('rel:${this.index}')">
219 <label class="cell" for="nameInput${this.index}">Name:</label>
220 <input class="cell" id="nameInput${this.index}"
221 data-mvc-bindings="value: at('rel:', 'First')">
222 <button type="button" onclick="setDetailsContext('${this.index}')">Details</button>
223 </div>
224 </div>
225 <div class="spacer"></div>
226
227 <div data-dojo-type="dojox.mvc.Group"
228 data-dojo-props="target: at('widget:listCtl', 'cursor')">
229 <div class="row">
230 <div style="display: inline-block;" id="detailsBanner">Details for result index: </div>
231 <span class="cell" id="indexOutput"
232 data-mvc-bindings="innerText: at('widget:listCtl', 'cursorIndex')"></span>
233 </div>
234 <div class="row">
235 <label class="cell" for="firstInput">First Name:</label>
236 <input class="cell" id="firstInput"
237 data-mvc-bindings="value: at('rel:', 'First')">
238 </div>
239 <div class="row">
240 <label class="cell" for="lastInput">Last Name:</label>
241 <input class="cell" id="lastInput"
242 data-mvc-bindings="value: at('rel:', 'Last')">
243 </div>
244 <div class="row">
245 <label class="cell" for="locationInput">Location:</label>
246 <input class="cell" id="locationInput"
247 data-mvc-bindings="value: at('rel:', 'Location')">
248 </div>
249 <div class="row">
250 <label class="cell" for="officeInput">Office:</label>
251 <input class="cell" id="officeInput"
252 data-mvc-bindings="value: at('rel:', 'Office')">
253 </div>
254 <div class="row">
255 <label class="cell" for="emailInput">Email:</label>
256 <input class="cell" id="emailInput"
257 data-mvc-bindings="value: at('rel:', 'Email')">
258 </div>
259 <div class="row">
260 <label class="cell" for="telInput">Telephone:</label>
261 <input class="cell" id="telInput"
262 data-mvc-bindings="value: at('rel:', 'Tel')">
263 </div>
264 <div class="row">
265 <label class="cell" for="faxInput">Fax:</label>
266 <input class="cell" id="faxInput"
267 data-mvc-bindings="value: at('rel:', 'Fax')">
268 </div>
269 </div>
270 </div>
271 </div>
272 </div>
273 </body>
274 </html>