| 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 |
<style> |
| 8 |
.adminlistitem { |
| 9 |
font-size:12px; |
| 10 |
margin-right: 10px; |
| 11 |
padding-right: 10px; |
| 12 |
line-height: 59px; /* 20px; */ |
| 13 |
height: 59px; |
| 14 |
} |
| 15 |
.admin2LineListItem1 { |
| 16 |
height: 16px; |
| 17 |
color: #222222; |
| 18 |
font-weight: bold; |
| 19 |
margin: -8px 0px 10px 8px; |
| 20 |
} |
| 21 |
.admin2LineListItem2 { |
| 22 |
height: 16px; |
| 23 |
color: #464646; |
| 24 |
font-weight: normal; |
| 25 |
margin: -13px 0 10px 8px; |
| 26 |
} |
| 27 |
|
| 28 |
</style> |
| 29 |
|
| 30 |
<title>MVC WidgetList with EdgeToEdgeList with icons and sub-label</title> |
| 31 |
|
| 32 |
<script type="text/javascript" src="../../../../dojox/mobile/deviceTheme.js" data-dojo-config="mblThemeFiles: ['base']"></script> |
| 33 |
|
| 34 |
|
| 35 |
<script type="text/javascript" src="../../../../dojo/dojo.js" |
| 36 |
data-dojo-config="isDebug: true, async: true, parseOnLoad: false, mvc: {debugBindings: true}"></script> |
| 37 |
|
| 38 |
<script type="text/javascript"> |
| 39 |
require([ |
| 40 |
"dojo/_base/lang", |
| 41 |
"dijit/registry", |
| 42 |
"dojo/parser", |
| 43 |
"dojo/store/Memory", |
| 44 |
"dojo/ready", |
| 45 |
"dojo/when", |
| 46 |
"dojox/mvc/EditStoreRefListController", |
| 47 |
"dojox/mvc/at", |
| 48 |
"dojox/mvc/Group", |
| 49 |
"dojox/mvc/Repeat", |
| 50 |
"dojox/mvc/Templated", |
| 51 |
"dojox/mvc/WidgetList", |
| 52 |
"dojox/mvc/Output", |
| 53 |
"dojox/mobile", |
| 54 |
"dojox/mobile/Button", |
| 55 |
"dojox/mobile/TextBox", |
| 56 |
"dojox/mobile/CheckBox", |
| 57 |
"dojox/mobile/EdgeToEdgeList", |
| 58 |
"dojox/mvc/WidgetList", |
| 59 |
"dojox/mvc/_InlineTemplateMixin", |
| 60 |
"dojox/mobile/deviceTheme" |
| 61 |
], function(lang, registry, parser, MemoryStore, ready, when, EditStoreRefListController){ |
| 62 |
var projects_init1 = { |
| 63 |
"identifier": "id", |
| 64 |
"items": [ |
| 65 |
{ |
| 66 |
"id" : "ID1001", |
| 67 |
"label" : "Project 01", |
| 68 |
"displayName" : "Project 01", |
| 69 |
"shortDesc" : "Short Description for project 01", |
| 70 |
"longDesc" : "Long Description for project 01", |
| 71 |
"checked" : true, |
| 72 |
"icon" : "../images/directory_45.png" |
| 73 |
}, |
| 74 |
{ |
| 75 |
"id" : "ID1002", |
| 76 |
"label" : "Project 02", |
| 77 |
"displayName" : "Project 02", |
| 78 |
"shortDesc" : "Short Description for project 02", |
| 79 |
"longDesc" : "Long Description for project 02", |
| 80 |
"checked" : true, |
| 81 |
"icon" : "../images/directory_45.png" |
| 82 |
}, |
| 83 |
{ |
| 84 |
"id" : "ID1003", |
| 85 |
"label" : "Project 03", |
| 86 |
"displayName" : "Project 03", |
| 87 |
"shortDesc" : "Short Description for project 03", |
| 88 |
"longDesc" : "Long Description for project 03", |
| 89 |
"checked" : false, |
| 90 |
"icon" : "../images/directory_45.png" |
| 91 |
} |
| 92 |
] |
| 93 |
}; |
| 94 |
|
| 95 |
var memStore1 = new MemoryStore({data : projects_init1}); |
| 96 |
|
| 97 |
ctrl = new EditStoreRefListController({store: memStore1}); |
| 98 |
when(ctrl.queryStore(), function(data){ |
| 99 |
model1 = ctrl.model; |
| 100 |
}); |
| 101 |
|
| 102 |
|
| 103 |
// when "dojo/ready" is ready call parser.parse (if not doing parseOnLoad) |
| 104 |
ready(function(){ |
| 105 |
parser.parse(); |
| 106 |
}); |
| 107 |
|
| 108 |
}); |
| 109 |
|
| 110 |
</script> |
| 111 |
</head> |
| 112 |
<body style="visibility:hidden;"> |
| 113 |
<script type="dojo/require">at: "dojox/mvc/at"</script> |
| 114 |
<script type="dojo/require">registry: "dijit/registry"</script> |
| 115 |
<div id="wrapper"> |
| 116 |
<div id="header"> |
| 117 |
<div id="navigation"></div> |
| 118 |
<div id="headerInsert"> |
| 119 |
<h4>MVC WidgetList with EdgeToEdgeList with icons and sub-label</h4> |
| 120 |
</div> |
| 121 |
</div> |
| 122 |
<div id="main"> |
| 123 |
<div id="leftNav"></div> |
| 124 |
<div id="mainContent"> |
| 125 |
<h5>EdgeToEdgeList with a WidgetList with child type of ListItem, sets label, icon and checked and multiple select.</h5> |
| 126 |
<ul data-dojo-type="dojox.mobile.EdgeToEdgeList" id="repeatId1B" select="multiple" |
| 127 |
data-dojo-mixins="dojox/mvc/WidgetList" |
| 128 |
data-mvc-child-type="dojox/mobile/ListItem" |
| 129 |
data-mvc-child-props="label: at(this.target, 'displayName'), |
| 130 |
icon: at(this.target, 'icon'), |
| 131 |
checked: at(this.target, 'checked'), |
| 132 |
variableHeight: true" |
| 133 |
data-dojo-props="children: model1"> |
| 134 |
</ul> |
| 135 |
|
| 136 |
<h5>EdgeToEdgeList with a WidgetList with child type of mvc/Templated with ListItem mixin, sets label, icon and checked and multiple select.</h5> |
| 137 |
<ul data-dojo-type="dojox.mobile.EdgeToEdgeList" id="repeatId1" |
| 138 |
data-dojo-props='select:"multiple", children: model1' |
| 139 |
data-dojo-mixins="dojox/mvc/WidgetList,dojox/mvc/_InlineTemplateMixin" |
| 140 |
data-mvc-child-type="dojox/mvc/Templated" |
| 141 |
data-mvc-child-mixins="dojox/mobile/ListItem" |
| 142 |
data-mvc-child-props="clickable: true, |
| 143 |
_relTargetProp: 'childTarget', // avoid using target for a ListItem since it uses that |
| 144 |
icon: at(this.childTarget, 'icon'), // setting icon: '../images/directory_45.png' works |
| 145 |
noArrow: true, |
| 146 |
indexAtStartup: this.indexAtStartup, |
| 147 |
checked: at(this.childTarget, 'checked'), |
| 148 |
onClick: function(e){ |
| 149 |
console.log(this.id); |
| 150 |
console.log(e); |
| 151 |
console.log(registry.byId(this.id)); |
| 152 |
console.log(this.indexAtStartup); return true;}"> |
| 153 |
<script type="dojox/mvc/InlineTemplate"> |
| 154 |
<li class="adminlistitem"> |
| 155 |
<div class="mblListItemLabel"> |
| 156 |
<div class="admin2LineListItem1" data-dojo-type="dojox/mvc/Output" |
| 157 |
data-dojo-props="value: at('rel:','displayName')"></div> |
| 158 |
<div class="admin2LineListItem2" data-dojo-type="dojox/mvc/Output" |
| 159 |
data-dojo-props="value: at('rel:','shortDesc')"></div> |
| 160 |
</div> |
| 161 |
</li> |
| 162 |
</script> |
| 163 |
</ul> |
| 164 |
|
| 165 |
<h5>WidgetList with an mvc/InlineTemplate, you can change the label, or checked here.</h5> |
| 166 |
<div id="repeatId2" data-dojo-type="dojox/mvc/WidgetList" |
| 167 |
data-dojo-mixins="dojox/mvc/_InlineTemplateMixin" |
| 168 |
data-dojo-props="children: model1"> |
| 169 |
<script type="dojox/mvc/InlineTemplate"> |
| 170 |
<div> |
| 171 |
<input class="cell" |
| 172 |
data-dojo-type="dojox/mobile/TextBox" |
| 173 |
data-dojo-props="value: at('rel:', 'displayName')"> |
| 174 |
<label for="CBInput${indexAtStartup}" |
| 175 |
data-dojo-type="dijit/_WidgetBase" |
| 176 |
data-dojo-props="_setValueAttr: {node: 'domNode', type: 'innerText'}, value: at('rel:', 'displayName')"></label> |
| 177 |
<input class="cell" type="checkbox" id="CBInput${indexAtStartup}" |
| 178 |
data-dojo-type="dojox/mobile/CheckBox" |
| 179 |
data-dojo-props="checked: at('rel:', 'checked')"> |
| 180 |
</div> |
| 181 |
</script> |
| 182 |
</div> |
| 183 |
</div> |
| 184 |
</div> |
| 185 |
</div> |
| 186 |
</div> |
| 187 |
</body> |
| 188 |
</html> |