85 lines
3.2 KiB
HTML
85 lines
3.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
<title>Dynamic Items</title>
|
|
<link href="../themes/iphone/base.css" rel="stylesheet">
|
|
|
|
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="parseOnLoad: true"></script>
|
|
|
|
<script language="JavaScript" type="text/javascript">
|
|
//dojo.require("dojo.parser"); // Use the lightweight parser.
|
|
dojo.require("dojo.hash");
|
|
dojo.require("dojox.mobile"); // This is a mobile app.
|
|
dojo.require("dojox.mobile.parser"); // This mobile app supports running on desktop browsers
|
|
dojo.require("dojox.mobile.compat"); // This mobile app uses declarative programming with fast mobile parser
|
|
dojo.require("dojox.mobile.Button");
|
|
|
|
var counter = 4;
|
|
dojo.ready(function(){
|
|
var btnWidget = dijit.byId("btn1");
|
|
dojo.connect(btnWidget.domNode, "onclick", onBtnClicked);
|
|
function onBtnClicked(e){
|
|
var listWidget = dijit.byId("list1");
|
|
for(var i = 1; i <= 3; i++){
|
|
var itemWidget = new dojox.mobile.ListItem({
|
|
icon: "images/i-icon-"+i+".png",
|
|
moveTo: "#bar&myParam=000"+counter,
|
|
label: "Document 000"+counter
|
|
});
|
|
listWidget.addChild(itemWidget);
|
|
counter++;
|
|
}
|
|
}
|
|
});
|
|
|
|
function loadPage(moveTo){
|
|
if(!(moveTo.match(/#(\w+)/))){ return; }
|
|
moveTo.match(/#(\w+)(.*)/);
|
|
var id = RegExp.$1;
|
|
var param = RegExp.$2;
|
|
if(!param){ return; }
|
|
var container = dojo.byId(id);
|
|
container.innerHTML = "";
|
|
var prog = dojox.mobile.ProgressIndicator.getInstance();
|
|
container.appendChild(prog.domNode);
|
|
prog.start();
|
|
setTimeout(function(){ // network latency simulation
|
|
prog.stop();
|
|
container.innerHTML = '<h1 dojoType="dojox.mobile.Heading" back="Home" moveTo="#home">'+param+'</h1>\n'+param;
|
|
dojox.mobile.parser.parse(container);
|
|
}, 5000);
|
|
}
|
|
dojo.declare("dojox.mobile.ViewEx",dojox.mobile.View,{
|
|
onStartView: function(){
|
|
loadPage(location.hash);
|
|
},
|
|
onBeforeTransitionIn: function(moveTo, dir, transition, context, method){
|
|
loadPage("#"+moveTo);
|
|
}
|
|
});
|
|
</script>
|
|
</head>
|
|
<body style="visibility:hidden;">
|
|
<div id="home" dojoType="dojox.mobile.View" selected="true">
|
|
<h1 dojoType="dojox.mobile.Heading">Dynamic Items</h1>
|
|
<h2 dojoType="dojox.mobile.RoundRectCategory">External Documents</h2>
|
|
<ul id="list1" dojoType="dojox.mobile.RoundRectList">
|
|
<li dojoType="dojox.mobile.ListItem" icon="images/i-icon-1.png" moveTo="#bar&myParam=0001">
|
|
Document 0001
|
|
</li>
|
|
<li dojoType="dojox.mobile.ListItem" icon="images/i-icon-2.png" moveTo="#bar&myParam=0002">
|
|
Document 0002
|
|
</li>
|
|
<li dojoType="dojox.mobile.ListItem" icon="images/i-icon-3.png" moveTo="#bar&myParam=0003">
|
|
Document 0003
|
|
</li>
|
|
</ul>
|
|
<button id="btn1" dojoType="dojox.mobile.Button" class="mblBlueButton" style="width:80px;margin-left:10px">More...</button>
|
|
</div>
|
|
|
|
<div id="bar" dojoType="dojox.mobile.ViewEx"></div>
|
|
</body>
|
|
</html>
|