Debian Codegraph @

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