2150 |
mathias |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
<title>TabContainer Demo</title>
|
|
|
6 |
|
|
|
7 |
<script type="text/javascript" djConfig="isDebug: true,parseOnLoad:true"
|
|
|
8 |
src="../../../dojo/dojo.js"></script>
|
|
|
9 |
<script type="text/javascript" src="../_testCommon.js"></script>
|
|
|
10 |
|
|
|
11 |
<script type="text/javascript">
|
|
|
12 |
dojo.require("dijit.layout.ContentPane");
|
|
|
13 |
dojo.require("dijit.layout.TabContainer");
|
|
|
14 |
dojo.require("dijit.Tooltip");
|
|
|
15 |
dojo.require("dijit.layout.LinkPane");
|
|
|
16 |
dojo.require("dijit.form.Button");
|
|
|
17 |
dojo.require("dojo.parser"); // scan page for widgets and instantiate them
|
|
|
18 |
|
|
|
19 |
var tabCounter;
|
|
|
20 |
function testClose(pane, tab){
|
|
|
21 |
// remove html from title
|
|
|
22 |
var title = dojo.trim(tab.title.replace(/<\/?[a-z][a-z0-9]*[^>]*>/ig, ""));
|
|
|
23 |
return confirm("Please confirm that you want tab "+title+" closed");
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
function randomMessageId(){
|
|
|
27 |
return Math.floor(Math.random() * 3) + 3;
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
function createTab(){
|
|
|
31 |
if(!tabCounter){ tabCounter = 3; }
|
|
|
32 |
|
|
|
33 |
var title = '<img src="../images/plus.gif" style="background-color:#95B7D3;"/> Tab ' +(++tabCounter);
|
|
|
34 |
var refreshOnShow = !!(tabCounter % 2);
|
|
|
35 |
|
|
|
36 |
var newTab = new dijit.layout.ContentPane({
|
|
|
37 |
title: title + (refreshOnShow ? ' <i>refreshOnShow</i>': ''),
|
|
|
38 |
closable:true,
|
|
|
39 |
refreshOnShow: refreshOnShow,
|
|
|
40 |
href: 'getResponse.php?delay=1000&messId='+randomMessageId()
|
|
|
41 |
+"&message="+encodeURI("<h1>Programmatically created Tab "+tabCounter+"</h1>")
|
|
|
42 |
}, dojo.doc.createElement('div'));
|
|
|
43 |
|
|
|
44 |
dijit.byId('ttabs').addChild(newTab);
|
|
|
45 |
|
|
|
46 |
newTab.startup(); // find parent TabContainer and subscribe to selectChild event
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
startTime = new Date();
|
|
|
50 |
dojo.addOnLoad(function(){
|
|
|
51 |
var elapsed = new Date().getTime() - startTime;
|
|
|
52 |
var p = document.createElement("p");
|
|
|
53 |
p.appendChild(document.createTextNode("Widgets loaded in " + elapsed + "ms"));
|
|
|
54 |
document.body.appendChild(p);
|
|
|
55 |
});
|
|
|
56 |
</script>
|
|
|
57 |
|
|
|
58 |
<style type="text/css">
|
|
|
59 |
@import "../../../dojo/resources/dojo.css";
|
|
|
60 |
@import "../css/dijitTests.css";
|
|
|
61 |
|
|
|
62 |
body {
|
|
|
63 |
font-family : sans-serif;
|
|
|
64 |
margin:20px;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
/* add padding to each contentpane inside the tab container, and scrollbar if necessary */
|
|
|
68 |
.dojoTabPane {
|
|
|
69 |
padding : 10px 10px 10px 10px;
|
|
|
70 |
overflow: auto;
|
|
|
71 |
}
|
|
|
72 |
</style>
|
|
|
73 |
</head>
|
|
|
74 |
<body>
|
|
|
75 |
|
|
|
76 |
<h1 class="testTitle">Dijit layout.TabContainer (delayed) remote tests</h1>
|
|
|
77 |
|
|
|
78 |
<p>These tabs are made up of external content. Loading is delayed to make it easier to see if refreshOnShow and preload = 'false' is working.<br/>
|
|
|
79 |
The tabs also tests to insert html in the Tab title
|
|
|
80 |
</p>
|
|
|
81 |
|
|
|
82 |
<div dojoType='dijit.form.Button' onClick='createTab()'>Create a Tab</div>
|
|
|
83 |
<div id="ttabs" dojoType="dijit.layout.TabContainer" tabPosition="top" style="width: 100%; height: 20em;">
|
|
|
84 |
<a id="ttab1" dojoType="dijit.layout.LinkPane"
|
|
|
85 |
href="getResponse.php?messId=3&delay=1000"
|
|
|
86 |
closable="true"
|
|
|
87 |
><img src='../images/copy.gif'/> Tab1</a>
|
|
|
88 |
<a id="ttab2" dojoType="dijit.layout.LinkPane"
|
|
|
89 |
href="getResponse.php?messId=4&delay=1000"
|
|
|
90 |
refreshOnShow="true" title="Tab 2 "
|
|
|
91 |
selected='true'
|
|
|
92 |
closable='true'
|
|
|
93 |
><i>refreshOnShow</i>
|
|
|
94 |
<img src='../images/cut.gif'/>
|
|
|
95 |
</a>
|
|
|
96 |
<a dojoType="dijit.layout.LinkPane"
|
|
|
97 |
href="getResponse.php?messId=5&delay=1000"
|
|
|
98 |
onClose="testClose"
|
|
|
99 |
closable="true"
|
|
|
100 |
>
|
|
|
101 |
<b>Tab 3</b>
|
|
|
102 |
<img src='../images/paste.gif'/>
|
|
|
103 |
</a>
|
|
|
104 |
</div>
|
|
|
105 |
|
|
|
106 |
<h3>Rendering time</h3>
|
|
|
107 |
|
|
|
108 |
</body>
|
|
|
109 |
</html>
|