| 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 "../../../../dijit/tests/css/dijitTests.css"; |
| 9 |
@import "../css/app-format.css"; |
| 10 |
</style> |
| 11 |
<link id="themeStyles" rel="stylesheet" href="../../../../dijit/themes/claro/claro.css"/> |
| 12 |
|
| 13 |
<script type="text/javascript"> |
| 14 |
require = { |
| 15 |
isDebug: 1, |
| 16 |
async: 1 |
| 17 |
}; |
| 18 |
</script> |
| 19 |
|
| 20 |
|
| 21 |
<script type="text/javascript" src="../../../../dojo/dojo.js"></script> |
| 22 |
|
| 23 |
<script type="text/javascript" src="./helpers.js"></script> |
| 24 |
<script type="text/javascript"> |
| 25 |
|
| 26 |
require([ |
| 27 |
"doh/runner", |
| 28 |
"dojo/parser", |
| 29 |
// "dojox/mobile/parser", |
| 30 |
"dijit/registry", |
| 31 |
"dojox/mvc/at", |
| 32 |
"dojox/mvc/getStateful", |
| 33 |
"dojo/store/Memory", |
| 34 |
"dojox/mvc/EditStoreRefListController", |
| 35 |
"dojo/dom", |
| 36 |
"dojo/store/Observable", |
| 37 |
"dijit/form/Button", |
| 38 |
"dijit/form/TextBox", |
| 39 |
"dojox/mvc/_atBindingExtension", |
| 40 |
"dojox/mvc/ListController", |
| 41 |
"dojox/mvc/StatefulArray", |
| 42 |
"dojox/mvc/Group", |
| 43 |
"dojox/mvc/Output", |
| 44 |
"dojox/mvc/Repeat", |
| 45 |
// "dojox/mvc/parserExtension", |
| 46 |
"dojo/domReady!" |
| 47 |
], function(doh, parser, registry, at, getStateful, Memory, EditStoreRefListController, dom){ |
| 48 |
function runTests(){ |
| 49 |
// should be able to verify all of the inputs |
| 50 |
doh.register("parse", [ |
| 51 |
{ |
| 52 |
name: "parse", |
| 53 |
runTest: function(){ |
| 54 |
console.log("in parse test with maxentries ="+maxentries); |
| 55 |
parser.parse(dom.byId("stateful")); |
| 56 |
} |
| 57 |
} |
| 58 |
]); |
| 59 |
doh.register("parse2", [ |
| 60 |
{ |
| 61 |
name: "parse", |
| 62 |
runTest: function(){ |
| 63 |
ctrl = new EditStoreRefListController({store: new Memory({data: data2})}); |
| 64 |
ctrl.queryStore(); |
| 65 |
|
| 66 |
console.log("in ctrl parse test with maxentries ="+maxentries); |
| 67 |
parser.parse(dom.byId("ctrl")); |
| 68 |
} |
| 69 |
} |
| 70 |
]); |
| 71 |
|
| 72 |
|
| 73 |
doh.run(); |
| 74 |
} |
| 75 |
|
| 76 |
window.at = at; |
| 77 |
|
| 78 |
//parser.parse(); |
| 79 |
|
| 80 |
setDetailsContext = function(index){ |
| 81 |
var ctl = registry.byId("listCtl"); |
| 82 |
ctl.set("cursorIndex", index); |
| 83 |
}; |
| 84 |
|
| 85 |
var data = [ |
| 86 |
{ |
| 87 |
id: "1", |
| 88 |
Group: "Engineer", |
| 89 |
First: "Anne", |
| 90 |
Last: "Ackerman", |
| 91 |
Location: "NY", |
| 92 |
Office: "1S76", |
| 93 |
Email: "[email protected]", |
| 94 |
Tel: "123-764-8237", |
| 95 |
Fax: "123-764-8228" |
| 96 |
}, |
| 97 |
{ |
| 98 |
id: "2", |
| 99 |
Group: "Engineer", |
| 100 |
First: "Ben", |
| 101 |
Last : "Beckham", |
| 102 |
Location: "NY", |
| 103 |
Office: "5N47", |
| 104 |
Email: "[email protected]", |
| 105 |
Tel: "123-764-8599", |
| 106 |
Fax: "123-764-8600" |
| 107 |
}, |
| 108 |
{ |
| 109 |
id: "3", |
| 110 |
Group: "Engineer", |
| 111 |
First: "Chad", |
| 112 |
Last: "Chapman", |
| 113 |
Location: "CA", |
| 114 |
Office: "1278", |
| 115 |
Email: "[email protected]", |
| 116 |
Tel: "408-764-8237", |
| 117 |
Fax: "408-764-8228" |
| 118 |
}, |
| 119 |
{ |
| 120 |
id: "4", |
| 121 |
Group: "Engineer", |
| 122 |
First: "David", |
| 123 |
Last: "Durham", |
| 124 |
Location: "NJ", |
| 125 |
Office: "C12", |
| 126 |
Email: "[email protected]", |
| 127 |
Tel: "514-764-8237", |
| 128 |
Fax: "514-764-8228" |
| 129 |
}, |
| 130 |
{ |
| 131 |
id: "5", |
| 132 |
Group: "Engineer", |
| 133 |
First: "Emma", |
| 134 |
Last: "Eklof", |
| 135 |
Location: "NY", |
| 136 |
Office: "4N76", |
| 137 |
Email: "[email protected]", |
| 138 |
Tel: "123-764-1234", |
| 139 |
Fax: "123-764-4321" |
| 140 |
}, |
| 141 |
{ |
| 142 |
id: "6", |
| 143 |
Group: "Manager", |
| 144 |
First: "Fred", |
| 145 |
Last: "Fisher", |
| 146 |
Location: "NJ", |
| 147 |
Office: "V89", |
| 148 |
Email: "[email protected]", |
| 149 |
Tel: "514-764-8567", |
| 150 |
Fax: "514-764-8000" |
| 151 |
}, |
| 152 |
{ |
| 153 |
id: "7", |
| 154 |
Group: "Manager", |
| 155 |
First: "George", |
| 156 |
Last: "Garnett", |
| 157 |
Location: "NY", |
| 158 |
Office: "7S11", |
| 159 |
Email: "[email protected]", |
| 160 |
Tel: "123-999-8599", |
| 161 |
Fax: "123-999-8600" |
| 162 |
}, |
| 163 |
{ |
| 164 |
id: "8", |
| 165 |
Group: "Accountant", |
| 166 |
First: "Hunter", |
| 167 |
Last: "Huffman", |
| 168 |
Location: "CA", |
| 169 |
Office: "6532", |
| 170 |
Email: "[email protected]", |
| 171 |
Tel: "408-874-8237", |
| 172 |
Fax: "408-874-8228" |
| 173 |
}, |
| 174 |
{ |
| 175 |
id: "9", |
| 176 |
Group: "Accountant", |
| 177 |
First: "Irene", |
| 178 |
Last: "Ira", |
| 179 |
Location: "NJ", |
| 180 |
Office: "F09", |
| 181 |
Email: "[email protected]", |
| 182 |
Tel: "514-764-6532", |
| 183 |
Fax: "514-764-7300" |
| 184 |
}, |
| 185 |
{ |
| 186 |
id: "10", |
| 187 |
Group: "Accountant", |
| 188 |
First: "John", |
| 189 |
Last: "Jacklin", |
| 190 |
Location: "CA", |
| 191 |
Office: "6701", |
| 192 |
Email: "[email protected]", |
| 193 |
Tel: "408-764-1234", |
| 194 |
Fax: "408-764-4321" |
| 195 |
} |
| 196 |
]; |
| 197 |
window.ctrl = null; |
| 198 |
var data2 = data; |
| 199 |
var currentId = 10; |
| 200 |
maxentries = 100; |
| 201 |
for(var a = data2, i = 0; i < maxentries; i++){ |
| 202 |
var d = { |
| 203 |
id: currentId++, |
| 204 |
Group: "Engineer", |
| 205 |
First: "First"+currentId, |
| 206 |
Last: "Last"+currentId, |
| 207 |
Location: "CA", |
| 208 |
Office: "6701", |
| 209 |
Email: "[email protected]"+currentId, |
| 210 |
Tel: "408-764-1234", |
| 211 |
Fax: "408-764-4321" |
| 212 |
}; |
| 213 |
data2.push(d); |
| 214 |
} |
| 215 |
searchRecords = {}; |
| 216 |
searchRecords.Results = getStateful(data2); |
| 217 |
|
| 218 |
runTests(); |
| 219 |
|
| 220 |
}); |
| 221 |
</script> |
| 222 |
</head> |
| 223 |
<body class="claro" style="width:100%;height:100%;margin:0;padding:0;"> |
| 224 |
<div id="header"> |
| 225 |
<div id="navigation"> |
| 226 |
</div> |
| 227 |
<div id="headerInsert"> |
| 228 |
<h1>Employee Search</h1> |
| 229 |
<h2>Master Detail Example - With repeat container.</h2> |
| 230 |
</div> |
| 231 |
</div> |
| 232 |
<div id="main"> |
| 233 |
<div id="leftNav"></div> |
| 234 |
<div id="mainContent"> |
| 235 |
<div id="ctrl"> |
| 236 |
|
| 237 |
<div data-dojo-type="dojox.mvc.Repeat" id="repeat1" data-dojo-props="children: at(ctrl, 'model')"> |
| 238 |
<div class="row" data-dojo-type="dijit._WidgetBase" data-dojo-props="target: at('rel:', ${this.index})"> |
| 239 |
<label class="cell" for="xnameInput${this.index}">Name:</label> |
| 240 |
<input class="cell" data-dojo-type="dijit.form.TextBox" id="xnameInput${this.index}" |
| 241 |
data-dojo-props="value: at('rel:', 'First')"> |
| 242 |
<button type="button" data-dojo-type="dijit.form.Button" |
| 243 |
data-dojo-props="onClick: function(){ ctrl.set('cursorIndex', ${this.index}); }">Details</button> |
| 244 |
<button type="button" data-dojo-type="dijit.form.Button" |
| 245 |
data-dojo-props="onClick: function(){ ctrl.addEmpty(); }">+</button> |
| 246 |
<button type="button" data-dojo-type="dijit.form.Button" |
| 247 |
data-dojo-props="onClick: function(){ ctrl.remove(${index}); }">-</button> |
| 248 |
</div> |
| 249 |
</div> |
| 250 |
</div> |
| 251 |
|
| 252 |
<div id="stateful"> |
| 253 |
<div id="searchBanner">Search Results for term: Engineers</div> |
| 254 |
<div data-dojo-type="dojox.mvc.Repeat" |
| 255 |
data-dojo-props="children: at('searchRecords', 'Results')"> |
| 256 |
<div class="row" data-dojo-type="dijit._WidgetBase" data-dojo-props="target: at('rel:', ${this.index})"> |
| 257 |
<label class="cell" for="ynameInput${this.index}">Name:</label> |
| 258 |
<input class="cell" data-dojo-type="dijit.form.TextBox" id="ynameInput${this.index}" |
| 259 |
data-dojo-props="value: at('rel:', 'First')"> |
| 260 |
<button type="button" data-dojo-type="dijit.form.Button" |
| 261 |
data-dojo-props="onClick: function(){ ctrl.set('cursorIndex', ${this.index}); }">Details</button> |
| 262 |
<button type="button" data-dojo-type="dijit.form.Button" |
| 263 |
data-dojo-props="onClick: function(){ ctrl.addEmpty(); }">+</button> |
| 264 |
<button type="button" data-dojo-type="dijit.form.Button" |
| 265 |
data-dojo-props="onClick: function(){ ctrl.remove(${index}); }">-</button> |
| 266 |
</div> |
| 267 |
</div> |
| 268 |
</div> |
| 269 |
<div class="spacer"></div> |
| 270 |
|
| 271 |
<div data-dojo-type="dojox.mvc.Group" |
| 272 |
data-dojo-props="target: at('widget:listCtl', 'cursor')"> |
| 273 |
<div class="row"> |
| 274 |
<div style="display: inline-block;" id="detailsBanner">Details for result index: </div> |
| 275 |
<span class="cell" id="indexOutput" data-dojo-type="dojox.mvc.Output" |
| 276 |
data-dojo-props="value: at('widget:listCtl', 'cursorIndex')"></span> |
| 277 |
</div> |
| 278 |
<div class="row"> |
| 279 |
<label class="cell" for="firstInput">First Name:</label> |
| 280 |
<input class="cell" id="firstInput" data-dojo-type="dijit.form.TextBox" |
| 281 |
data-dojo-props="value: at('rel:', 'First')"> |
| 282 |
</div> |
| 283 |
<div class="row"> |
| 284 |
<label class="cell" for="lastInput">Last Name:</label> |
| 285 |
<input class="cell" id="lastInput" data-dojo-type="dijit.form.TextBox" |
| 286 |
data-dojo-props="value: at('rel:', 'Last')"> |
| 287 |
</div> |
| 288 |
<div class="row"> |
| 289 |
<label class="cell" for="locationInput">Location:</label> |
| 290 |
<input class="cell" id="locationInput" data-dojo-type="dijit.form.TextBox" |
| 291 |
data-dojo-props="value: at('rel:', 'Location')"> |
| 292 |
</div> |
| 293 |
<div class="row"> |
| 294 |
<label class="cell" for="officeInput">Office:</label> |
| 295 |
<input class="cell" id="officeInput" data-dojo-type="dijit.form.TextBox" |
| 296 |
data-dojo-props="value: at('rel:', 'Office')"> |
| 297 |
</div> |
| 298 |
<div class="row"> |
| 299 |
<label class="cell" for="emailInput">Email:</label> |
| 300 |
<input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox" |
| 301 |
data-dojo-props="value: at('rel:', 'Email')"> |
| 302 |
</div> |
| 303 |
<div class="row"> |
| 304 |
<label class="cell" for="telInput">Telephone:</label> |
| 305 |
<input class="cell" id="telInput" data-dojo-type="dijit.form.TextBox" |
| 306 |
data-dojo-props="value: at('rel:', 'Tel')"> |
| 307 |
</div> |
| 308 |
<div class="row"> |
| 309 |
<label class="cell" for="faxInput">Fax:</label> |
| 310 |
<input class="cell" id="faxInput" data-dojo-type="dijit.form.TextBox" |
| 311 |
data-dojo-props="value: at('rel:', 'Fax')"> |
| 312 |
</div> |
| 313 |
</div> |
| 314 |
</div> |
| 315 |
</div> |
| 316 |
</body> |
| 317 |
</html> |