Debian Codegraph @

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