Debian Codegraph @

dojox/mvc/tests/1.7/mobile/test_mobile-list-multiple-sel-mvc.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
5 <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
6 <meta name="apple-mobile-web-app-capable" content="yes"/>
7 <title>MVC Repeat with Selectable RoundRectDataList - Multiple Select</title>
8
9 <script type="text/javascript" src="./../../../dojox/mobile/deviceTheme.js" data-dojo-config="mblThemeFiles: ['base']"></script>
10
11 <!-- required: dojo.js -->
12 <script type="text/javascript" src="../../../../../dojo/dojo.js"
13 data-dojo-config="isDebug: true, async: true, parseOnLoad: false"></script>
14
15 <script type="text/javascript">
16 require([
17 "dojox",
18 "dojox/mvc",
19 //"dojox/mobile/parser",
20 "dojo/parser",
21 "dojo/store/Memory",
22 "dojo/ready",
23 "dojox/mvc/_patches",
24 "dojox/mvc/at",
25 "dojox/mvc/Group",
26 "dojox/mvc/Repeat",
27 "dojox/mvc/Output",
28 "dojox/mobile",
29 "dojox/mobile/ScrollableView",
30 "dojox/mobile/Button",
31 "dojox/mobile/TextArea",
32 "dojox/mobile/TextBox",
33 "dojox/mobile/CheckBox",
34 "dojox/mobile/ViewController",
35 "dojox/mobile/FixedSplitter",
36 "dojox/mobile/EdgeToEdgeList",
37 "dojox/mobile/EdgeToEdgeCategory",
38 "dojox/mobile/deviceTheme",
39 "dojox/mobile/RoundRectCategory",
40 "dojox/mobile/Heading"
41 ], function(dojox, mvc, parser, MemoryStore, ready){
42
43 var search_results_init1 =
44 [{
45 "Query" : "Engineers1",
46 "Results" : [
47 {
48 "First" : "Anne1",
49 "Last" : "Ackerman1",
50 "Checked" : true
51 },
52 {
53 "First" : "Ben1",
54 "Last" : "Beckham1",
55 "Checked" : false
56 },
57 {
58 "First" : "Chad1",
59 "Last" : "Chapman1",
60 "Checked" : false
61 }
62 ]
63 }];
64
65 var search_results_init2 =
66 [{
67 "Query" : "Engineers1",
68 "Results" : [
69 {
70 "First" : "Anne2",
71 "Last" : "Ackerman2",
72 "Checked" : false
73 },
74 {
75 "First" : "Ben2",
76 "Last" : "Beckham2",
77 "Checked" : true
78 },
79 {
80 "First" : "Chad2",
81 "Last" : "Chapman2",
82 "Checked" : false
83 }
84 ]
85 }];
86 var memStore1 = new MemoryStore({data : search_results_init1});
87 model1 = mvc.newStatefulModel({ store : memStore1 })[0];
88
89 var memStore2 = new MemoryStore({data : search_results_init2});
90 model2 = mvc.newStatefulModel({ store : memStore2 })[0];
91
92 // when "dojo/ready" is ready call parser.parse (if not doing parseOnLoad)
93 ready(function(){
94 parser.parse();
95 });
96
97
98
99 });
100
101 // called to reset the model for each of the repeats
102 function swapToModel1() {
103 dijit.byId('repeatId1').set('ref',model1.Results);
104 dijit.byId('repeatId2').set('ref',model1.Results);
105 dijit.byId('repeatid2arem').set('ref',model1.Results);
106 dijit.byId('repeatid2aremg').set('ref',model1.Results);
107 dijit.byId('repeatid2a').set('ref',model1.Results);
108 };
109
110 function swapToModel2() {
111 dijit.byId('repeatId1').set('ref',model2.Results);
112 dijit.byId('repeatId2').set('ref',model2.Results);
113 dijit.byId('repeatid2arem').set('ref',model2.Results);
114 dijit.byId('repeatid2aremg').set('ref',model2.Results);
115 dijit.byId('repeatid2a').set('ref',model2.Results);
116 };
117
118
119 </script>
120 </head>
121 <body style="visibility:hidden;">
122 <div id="wrapper">
123 <div id="header">
124 <div id="navigation"></div>
125 <div id="headerInsert">
126 <h2>MVC Repeat with Selectable RoundRectList - Multiple Select</h2>
127 </div>
128 </div>
129 <div id="main">
130 <div id="leftNav"></div>
131 <div id="mainContent">
132 <h4>Here is one using dojox.mvc.Repeat as a mixin with no Group and dojo.parser instead of dojox.mobile.parser it is all good using mixin.</h4>
133 <ul data-dojo-type="dojox.mobile.RoundRectList" id="repeatId1" select="multiple"
134 data-dojo-mixins="dojox.mvc.Repeat" data-dojo-props="exprchar:'#', ref:'model1.Results'">
135 <li id="configure_itemmix1#{this.index}" class="mblVariableHeight" data-dojo-type="dojox.mobile.ListItem"
136 data-dojo-props="label: dojox.mvc.at('rel:#{this.index}.First', 'value'),
137 checked: dojox.mvc.at('rel:#{this.index}.Checked', 'value')">
138 </li>
139 </ul>
140
141 <h4>Here is one using MVC using Repeat no Group, with removeRepeatNode set true it is all good if Repeat sets select and onCheckStateChanged.</h4>
142 <ul data-dojo-type="dojox.mobile.RoundRectList" id="repeatparentidrem" select="multiple">
143 <div data-dojo-type="dojox.mvc.Repeat" id="repeatid2arem" data-dojo-props="exprchar:'#', ref:'model1.Results', removeRepeatNode:true">
144 <li id="configure_itemrem#{this.index}" class="mblVariableHeight" data-dojo-type="dojox.mobile.ListItem"
145 data-dojo-props="label: dojox.mvc.at('rel:#{this.index}.First', 'value'),
146 checked: dojox.mvc.at('rel:#{this.index}.Checked', 'value')">
147 </li>
148 </div>
149 </ul>
150
151 <h4>Here is one using MVC using Repeat with a Group, with removeRepeatNode set true it is all good if Repeat sets select and onCheckStateChanged.</h4>
152 <ul data-dojo-type="dojox.mobile.RoundRectList" id="repeatparentidremg" select="multiple">
153 <div data-dojo-type="dojox.mvc.Repeat" id="repeatid2aremg" data-dojo-props="exprchar:'#', ref:'model1.Results', removeRepeatNode:true">
154 <div data-dojo-type="dojox.mvc.Group" data-dojo-props="ref: '#{this.index}'">
155 <li id="configure_itemremg#{this.index}" class="mblVariableHeight" data-dojo-type="dojox.mobile.ListItem"
156 data-dojo-props="label: dojox.mvc.at('rel:First', 'value'),
157 checked: dojox.mvc.at('rel:Checked', 'value')">
158 </li>
159 </div>
160 </div>
161 </ul>
162
163 <h4>You can update the label or checked from here to update the model.</h4>
164 <div id="repeatparentid2">
165 <div id="repeatId2" data-dojo-type="dojox.mvc.Repeat" data-dojo-props="ref:'model1.Results'">
166 <input class="cell" data-dojo-type="dojox.mobile.TextBox" id="nameInput2${this.index}"
167 data-dojo-props="value: dojox.mvc.at('rel:${this.index}.First', 'value')"/>
168 <label data-dojo-type="dojox.mvc.Output" for="CBInput${this.index}"
169 data-dojo-props="value: dojox.mvc.at('rel:${this.index}.First', 'value')"/></label>
170 <input class="cell" type="checkbox" data-dojo-type="dojox.mobile.CheckBox" id="CBInput${this.index}"
171 data-dojo-props="checked: dojox.mvc.at('rel:${this.index}.Checked', 'value')"/>
172 </div>
173 </div>
174
175 <br/>Model:
176 <button type="button" data-dojo-type="dojox.mobile.Button" data-dojo-props="onClick: function(){swapToModel2();}">Swap Model2</button>
177 <button type="button" data-dojo-type="dojox.mobile.Button" data-dojo-props="onClick: function(){swapToModel1();}">Swap Model1</button>
178 <button id="reset" type="button" data-dojo-type="dojox.mobile.Button" data-dojo-props="onClick: function(){model1.reset();model2.reset();}">Reset all</button>
179
180 <h4>Here is one using MVC using Repeat no Group, using useParent it has style and
181 selection problems because of the Group nodes, updates to the model are reflected here, looks good, but has selection problems...
182 Also the Swap model buttons do not work with this one.
183 </h4>
184 <ul data-dojo-type="dojox.mobile.RoundRectList" id="repeatparentid" select="multiple">
185 <div data-dojo-type="dojox.mvc.Repeat" id="repeatid2a" data-dojo-props="exprchar:'#', ref:'model1.Results', useParent:'repeatparentid'">
186 <li id="configure_item#{this.index}" class="mblVariableHeight" data-dojo-type="dojox.mobile.ListItem"
187 data-dojo-props="label: dojox.mvc.at('model1.Results.#{this.index}.First', 'value'),
188 checked: dojox.mvc.at('model1.Results.#{this.index}.Checked', 'value')">
189 </li>
190 </div>
191 </ul>
192
193 <!--
194 <h4>Here is a normal RoundRectList for comparison Item one should be selected</h4>
195 <ul id="list1a" data-dojo-type="dojox.mobile.RoundRectList" select="multiple" >
196 <li id="configure_itemXX0" class="mblVariableHeight" data-dojo-type="dojox.mobile.ListItem"
197 data-dojo-props="label: dojox.mvc.at(model1.Results[0].First, 'value'),
198 checked: dojox.mvc.at(model1.Results[0].Checked, 'value')">
199 </li>
200 <li id="configure_itemXX1" class="mblVariableHeight" data-dojo-type="dojox.mobile.ListItem"
201 data-dojo-props="label: dojox.mvc.at(model1.Results[1].First, 'value'),
202 checked: dojox.mvc.at(model1.Results[1].Checked, 'value')">
203 </li>
204 </ul>
205 -->
206 </div>
207 </div>
208 </div>
209 </body>
210 </html>