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>Dynamic Icons</title> |
---|
8 | |
---|
9 | <link href="../../../dijit/themes/tundra/tundra.css" rel="stylesheet"/> |
---|
10 | <script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','Button','IconContainer']"></script> |
---|
11 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: false, parseOnLoad: true"></script> |
---|
12 | |
---|
13 | <script type="text/javascript"> |
---|
14 | require([ |
---|
15 | "dojo/_base/connect", |
---|
16 | "dojo/ready", |
---|
17 | "dijit/registry", |
---|
18 | "dojox/mobile/IconItem", |
---|
19 | "dojox/mobile/IconContainer", |
---|
20 | "dojox/mobile/Button", |
---|
21 | "dojox/mobile/parser", |
---|
22 | "dojox/mobile", |
---|
23 | "dojox/mobile/compat" |
---|
24 | ], function(connect, ready, registry, IconItem){ |
---|
25 | ready(function(){ |
---|
26 | var btnWidget = registry.byId("btn1"); |
---|
27 | connect.connect(btnWidget.domNode, "onclick", onBtnClicked); |
---|
28 | function onBtnClicked(e){ |
---|
29 | var iconContainerWidget = registry.byId("ic1"); |
---|
30 | var itemWidget = new IconItem({ |
---|
31 | icon: "images/icon-1.png", |
---|
32 | label: "new icon", |
---|
33 | lazy: true |
---|
34 | }); |
---|
35 | itemWidget.set("content", "<div data-dojo-type='dijit._Calendar'></div>"); |
---|
36 | iconContainerWidget.addChild(itemWidget); |
---|
37 | } |
---|
38 | }); |
---|
39 | }); |
---|
40 | </script> |
---|
41 | |
---|
42 | <style> |
---|
43 | .box { |
---|
44 | border: 1px solid #A7C0E0; |
---|
45 | width: 300px; |
---|
46 | height: 250px; |
---|
47 | background-image: url(images/widget-bg.png); |
---|
48 | background-repeat: no-repeat; |
---|
49 | background-color: white; |
---|
50 | } |
---|
51 | </style> |
---|
52 | </head> |
---|
53 | <body style="visibility:hidden;" class="tundra"> |
---|
54 | <div id="myhome" data-dojo-type="dojox.mobile.View" data-dojo-props='selected:true'> |
---|
55 | <ul id="ic1" data-dojo-type="dojox.mobile.IconContainer"> |
---|
56 | <li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"test1", icon:"images/icon-1.png", lazy:true'><div class="box"></div></li> |
---|
57 | </ul> |
---|
58 | <button id="btn1" data-dojo-type="dojox.mobile.Button" class="mblBlueButton" style="width:80px;margin-left:10px">More...</button> |
---|
59 | </div> |
---|
60 | </body> |
---|
61 | </html> |
---|