aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/data/tests/ml/test_HtmlStore_remote.html
blob: f9d9effaadca5a4640506f5ee4b9f385d7e55253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Dojox HtmlDataStore Widget</title>
<style>
	@import "../../../../dijit/themes/tundra/tundra.css";
	@import "../../../../dojo/resources/dojo.css";
	@import "../../../../dijit/tests/css/dijitTests.css";
</style>
<script type="text/javascript">
	djConfig = {
		isDebug: true,
		parseOnLoad: true
	};
</script>
<script type="text/javascript" src="../../../../dojo/dojo.js"></script>
<!--
<script language="JavaScript" type="text/javascript">
	dojo.require("doh.runner");
	function registerTests() {
		doh.register("t", 
			[
				function testTableLoaded(t){
					t.assertTrue(tableStore !== null);
					t.assertTrue(tableStore !== undefined);
				}
			]
		);
		doh.run();
	};
	dojo.addOnLoad(registerTests);
</script>
-->

<script language="JavaScript" type="text/javascript">
	dojo.require("dojo.parser");
	dojo.require("dojox.data.HtmlStore");
	dojo.require("dijit.Tree");
	dojo.require("dijit.form.ComboBox");
	
	function init() {
		var table = tableStore;
		
		function testComplete(items, request){
			console.debug("Completed!");

			var attributes = null;
			for(var i = 0; i < items.length; i++){
				attributes = table.getAttributes(items[i]);
				for(var j=0; j < attributes.length; j++){
					console.debug("attribute: [" + attributes[j] + "] have value: " + table.getValue(items[i], attributes[j]));
				}
			}
			
		}
		table.fetch({query:{X:1}, onComplete: testComplete});
		table.fetch({query:{X:2}, onComplete: testComplete});
		table.fetch({query:{X:3}, onComplete: testComplete}); 
		table.fetch({query:{X:4}, onComplete: testComplete}); 
		table.fetch({query:{X:5}, onComplete: testComplete}); // Should be empty
	}
	dojo.addOnLoad(init);
</script>

</head>
<body class="tundra">
	<h1>Dojox HtmlDataStore Widget</h1>
	<hr/>
	<br/>
	<br/>

	<!-- Instantiate the HtmlStore and bind it to global name tableStore -->
	<div dojoType="dojox.data.HtmlStore" url="table.html" dataId="tableExample" jsId="tableStore"></div>
	<div dojoType="dojox.data.HtmlStore" url="unorderedList.html" dataId="ulExample" jsId="ulStore"></div>
	<div dojoType="dojox.data.HtmlStore" url="orderedList.html" dataId="olExample" jsId="olStore"></div>
	<div dojoType="dojox.data.HtmlStore" url="divList.html" dataId="divExample" jsId="divStore"></div>

	<blockquote>
		<b>Table Rows: <br/><i>(Just to show that the tree can determine that the tableStore works like a store).<br/>Should have three branches, where the row had attr Y value of 3.</i></b>
		<div dojoType="dijit.Tree" id="tree" store="tableStore" query="{Y:3}"></div>
	</blockquote>
	
	<label for="combo1">Unordered List in ComboBox: </label>
	<input dojoType="dijit.form.ComboBox" value="Red" class="medium" store="ulStore" searchAttr="name" style="width: 300px;" name="ul.item1" id="combo1"	>

	<blockquote>
		<b>Unordered List in Tree: <br/></b>
		<div dojoType="dijit.Tree" id="tree2" labelAttr="name" store="ulStore" query="{name:'*'}"></div>
	</blockquote>

	<label for="combo2">Ordered List in ComboBox: </label>
	<input dojoType="dijit.form.ComboBox" value="Every" class="medium" store="olStore" searchAttr="name" style="width: 300px;" name="ol.item1" id="combo2" >

	<blockquote>
		<b>Ordered List in Tree: <br/></b>
		<div dojoType="dijit.Tree" id="tree3" labelAttr="name" store="olStore" query="{name:'*'}"></div>
	</blockquote>

	
	<div id="divExample">
		<div><b>bold</b></div>
		<div><i>italic</i></div>
		<div><i>normal</i></div>
	</div>
	
	<label for="combo3">Div List in ComboBox: </label>
	<input dojoType="dijit.form.ComboBox" value="bold" class="medium" store="divStore" searchAttr="name" style="width: 300px;" name="bold" id="combo3" >

	<blockquote>
		<b>Div list in tree: <br/></b>
		<div dojoType="dijit.Tree" id="tree4" labelAttr="name" store="divStore" query="{name:'*'}"></div>
	</blockquote>
	
</body>
</html>