| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>MVC Repeat with Multiattribute Test</title> |
| 6 |
|
| 7 |
<style type="text/css"> |
| 8 |
@import "../../../../dijit/themes/claro/document.css"; |
| 9 |
@import "../../../../dijit/tests/css/dijitTests.css"; |
| 10 |
</style> |
| 11 |
|
| 12 |
|
| 13 |
<link id="themeStyles" rel="stylesheet" href="../../../../dijit/themes/claro/claro.css"/> |
| 14 |
|
| 15 |
|
| 16 |
<script type="text/javascript" src="../../../../dojo/dojo.js" |
| 17 |
data-dojo-config="isDebug: true, async: true, mvc: {debugBindings: true}"></script> |
| 18 |
|
| 19 |
<script type="text/javascript"> |
| 20 |
require([ |
| 21 |
"dojox", |
| 22 |
"dojox/mvc", |
| 23 |
"dojo/parser", |
| 24 |
"dojo/store/Memory", |
| 25 |
"dojox/mvc/at", |
| 26 |
"dojox/mvc/_patches", |
| 27 |
"dojox/mvc/Group", |
| 28 |
"dojox/mvc/Repeat", |
| 29 |
"dojox/mvc/Output", |
| 30 |
"dijit/form/Button", |
| 31 |
"dijit/form/DropDownButton", |
| 32 |
"dijit/form/ComboButton", |
| 33 |
"dijit/form/ToggleButton", |
| 34 |
"dijit/ColorPalette", |
| 35 |
"dijit/TooltipDialog", |
| 36 |
"dijit/form/TextBox", |
| 37 |
"dijit/Menu", |
| 38 |
"dijit/MenuItem", |
| 39 |
"dijit/form/TextBox", |
| 40 |
"dijit/form/Select", |
| 41 |
"dijit/form/CheckBox" |
| 42 |
], function(dojox, mvc, parser, MemoryStore, at){ |
| 43 |
//(cutItemModel = new dojo.Stateful).set("iconClass", "dijitEditorIcon dijitEditorIconCut"); |
| 44 |
//(copyItemModel = new dojo.Stateful).set("iconClass", "dijitEditorIcon dijitEditorIconCopy").set("label", "Copy"); |
| 45 |
//(boldItemModel = new dojo.Stateful).set("checked", false); |
| 46 |
// window.at = at; |
| 47 |
|
| 48 |
var search_results_init1 = |
| 49 |
[{ |
| 50 |
"Query" : "Engineers1", |
| 51 |
"Results" : [ |
| 52 |
{ |
| 53 |
"First" : "Anne1", |
| 54 |
"Last" : "Ackerman1", |
| 55 |
"Checked" : true |
| 56 |
}, |
| 57 |
{ |
| 58 |
"First" : "Ben1", |
| 59 |
"Last" : "Beckham1", |
| 60 |
"Checked" : false |
| 61 |
}, |
| 62 |
{ |
| 63 |
"First" : "Chad1", |
| 64 |
"Last" : "Chapman1", |
| 65 |
"Checked" : true |
| 66 |
} |
| 67 |
] |
| 68 |
}]; |
| 69 |
var search_results_init2 = |
| 70 |
[{ |
| 71 |
"Query" : "Engineers2", |
| 72 |
"Results" : [ |
| 73 |
{ |
| 74 |
"First" : "Anne2", |
| 75 |
"Last" : "Ackerman2", |
| 76 |
"Checked" : true |
| 77 |
}, |
| 78 |
{ |
| 79 |
"First" : "Ben2", |
| 80 |
"Last" : "Beckham2", |
| 81 |
"Checked" : false |
| 82 |
} |
| 83 |
] |
| 84 |
}]; |
| 85 |
var search_results_init3 = |
| 86 |
[{ |
| 87 |
"Query" : "Engineers3", |
| 88 |
"Results" : [ |
| 89 |
{ |
| 90 |
"First" : "", |
| 91 |
"Last" : "", |
| 92 |
"Checked" : true |
| 93 |
} |
| 94 |
] |
| 95 |
}]; |
| 96 |
|
| 97 |
var memStore1 = new MemoryStore({data : search_results_init1}); |
| 98 |
model1 = mvc.newStatefulModel({ store : memStore1 })[0]; |
| 99 |
var memStore2 = new MemoryStore({data : search_results_init2}); |
| 100 |
model2 = mvc.newStatefulModel({ store : memStore2 })[0]; |
| 101 |
var memStore3 = new MemoryStore({data : search_results_init3}); |
| 102 |
model3 = mvc.newStatefulModel({ store : memStore3 })[0]; |
| 103 |
|
| 104 |
parser.parse(); |
| 105 |
}); |
| 106 |
</script> |
| 107 |
</head> |
| 108 |
<body class="claro"> |
| 109 |
<script type="dojo/require">at: "dojox/mvc/at"</script> |
| 110 |
<div id="wrapper"> |
| 111 |
<div id="header"> |
| 112 |
<div id="navigation"></div> |
| 113 |
<div id="headerInsert"> |
| 114 |
<h1>Input Output Sync</h1> |
| 115 |
<h2>Data Binding Example</h2> |
| 116 |
</div> |
| 117 |
</div> |
| 118 |
<div id="main"> |
| 119 |
<div id="leftNav"></div> |
| 120 |
<div id="mainContent"> |
| 121 |
<div class="row"> |
| 122 |
<button type="button" data-dojo-type="dijit/form/Button" data-dojo-props="onClick: function(){dijit.byId('outergroupId').set('ref',model1);}">Swap Model1</button> |
| 123 |
<button type="button" data-dojo-type="dijit/form/Button" data-dojo-props="onClick: function(){dijit.byId('outergroupId').set('ref',model2);}">Swap Model2</button> |
| 124 |
<button type="button" data-dojo-type="dijit/form/Button" data-dojo-props="onClick: function(){dijit.byId('outergroupId').set('target',at(model3));}">Swap Model3</button> |
| 125 |
</div> |
| 126 |
<div id="outergroupId" data-dojo-type="dojox/mvc/Group" data-dojo-props="target: at('model1')"> |
| 127 |
<div id="repeatId" data-dojo-type="dojox/mvc/Repeat" data-dojo-props="children: at('rel:', 'Results')"> |
| 128 |
<div class="row" data-dojo-type="dojox/mvc/Group" data-dojo-props="target: at('rel:${this.index}')"> |
| 129 |
<input class="cell" data-dojo-type="dijit/form/CheckBox" id="CBInput${this.index}" data-dojo-props="checked: at('rel:Checked', 'value')"/> |
| 130 |
<label data-dojo-type="dojox/mvc/Output" for="CBInput${this.index}" data-dojo-props="ref: 'First'"></label> |
| 131 |
|
| 132 |
<input class="cell" data-dojo-type="dijit/form/TextBox" id="nameInput${this.index}" data-dojo-props="value: at('rel:First', 'value')"/> |
| 133 |
<input class="cell" data-dojo-type="dijit/form/TextBox" id="nameInputLast${this.index}" data-dojo-props="value: at('Last', 'value')"/> |
| 134 |
</div> |
| 135 |
</div> |
| 136 |
</div> |
| 137 |
<div class="row"> |
| 138 |
<span> |
| 139 |
Model1 Output is ==> |
| 140 |
</span> |
| 141 |
<span id="CBOutput10" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model1.Results[0].Checked"> |
| 142 |
Checked1 is "${this.value}" : |
| 143 |
</span> |
| 144 |
<span id="firstnameOutput10" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model1.Results[0].First"> |
| 145 |
First1 is "${this.value}" : |
| 146 |
</span> |
| 147 |
<span id="lastnameOutput10" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model1.Results[0].Last"> |
| 148 |
Last1 is "${this.value}" : |
| 149 |
</span> |
| 150 |
<span id="CBOutput11" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model1.Results[1].Checked"> |
| 151 |
Checked2 is "${this.value}" : |
| 152 |
</span> |
| 153 |
<span id="firstnameOutput11" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model1.Results[1].First"> |
| 154 |
First2 is "${this.value}" : |
| 155 |
</span> |
| 156 |
<span id="lastnameOutput11" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model1.Results[1].Last"> |
| 157 |
Last2 is "${this.value}" : |
| 158 |
</span> |
| 159 |
<span id="CBOutput12" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model1.Results[2].Checked"> |
| 160 |
Checked3 is "${this.value}" : |
| 161 |
</span> |
| 162 |
<span id="firstnameOutput12" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model1.Results[2].First"> |
| 163 |
First3 is "${this.value}" : |
| 164 |
</span> |
| 165 |
<span id="lastnameOutput12" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model1.Results[2].Last"> |
| 166 |
Last3 is "${this.value}" |
| 167 |
</span> |
| 168 |
</div> |
| 169 |
<div class="row"> |
| 170 |
<span> |
| 171 |
Model2 Output is ==> |
| 172 |
</span> |
| 173 |
<span id="CBOutput20" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model2.Results[0].Checked"> |
| 174 |
Checked1 is "${this.value}" : |
| 175 |
</span> |
| 176 |
<span id="firstnameOutput20" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model2.Results[0].First"> |
| 177 |
First1 is "${this.value}" : |
| 178 |
</span> |
| 179 |
<span id="lastnameOutput20" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model2.Results[0].Last"> |
| 180 |
Last1 is "${this.value}" : |
| 181 |
</span> |
| 182 |
<span id="CBOutput21" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model2.Results[1].Checked"> |
| 183 |
Checked2 is "${this.value}" : |
| 184 |
</span> |
| 185 |
<span id="firstnameOutput21" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model2.Results[1].First"> |
| 186 |
First2 is "${this.value}" : |
| 187 |
</span> |
| 188 |
<span id="lastnameOutput21" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model2.Results[1].Last"> |
| 189 |
Last2 is "${this.value}" |
| 190 |
</span> |
| 191 |
</div> |
| 192 |
<div class="row"> |
| 193 |
<span> |
| 194 |
Model3 Output is ==> |
| 195 |
</span> |
| 196 |
<span id="CBOutput30" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model3.Results[0].Checked"> |
| 197 |
Checked1 is "${this.value}" : |
| 198 |
</span> |
| 199 |
<span id="firstnameOutput30" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model3.Results[0].First"> |
| 200 |
First1 is "${this.value}" : |
| 201 |
</span> |
| 202 |
<span id="lastnameOutput30" data-dojo-type="dojox/mvc/Output" data-dojo-props="ref: model3.Results[0].Last"> |
| 203 |
Last1 is "${this.value}" |
| 204 |
</span> |
| 205 |
</div> |
| 206 |
<br/>Model: |
| 207 |
<button id="reset" type="button" data-dojo-type="dijit/form/Button" data-dojo-props="onClick: function(){model1.reset();model2.reset();model3.reset();}">Reset all</button> |
| 208 |
</div> |
| 209 |
</div> |
| 210 |
</div> |
| 211 |
</body> |
| 212 |
</html> |