aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/grid/tests/test_sizing_ResizeHandle.html
blob: d6809df9c06046e6d6ae2e3ae25f58822cd25220 (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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>dojox.Grid Sizing Example</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
	<style type="text/css">
		@import "../../../dojo/resources/dojo.css";
		@import "../../../dijit/tests/css/dijitTests.css";
		@import "../_grid/tundraGrid.css";
		@import "../../layout/resources/ResizeHandle.css";

		.heading {
			font-weight: bold;
			padding-bottom: 0.25em;
		}
		
		#bar, #container {
			width: 400px;
			height: 200px;
			border: 4px double #333; 
		}
				
		#grid { 
			border: 1px solid #333;
		}
	</style>
	<script type="text/javascript" src="../../../dojo/dojo.js" 
		djConfig="isDebug:false, parseOnLoad: true"></script>

	<script type="text/javascript">
		dojo.require("dojox.grid.Grid");
		dojo.require("dojo.parser");
		dojo.require("dojox.layout.ResizeHandle");
	</script>
	<script type="text/javascript">
		data = [ 
			[ "normal", false, "new", 'But are not followed by two hexadecimal', 29.91, 10, false ],
			[ "important", false, "new", 'Because a % sign always indicates', 9.33, -5, false ],
			[ "important", false, "read", 'Signs can be selectively', 19.34, 0, true ],
			[ "note", false, "read", 'However the reserved characters', 15.63, 0, true ],
			[ "normal", false, "replied", 'It is therefore necessary', 24.22, 5.50, true ],
			[ "important", false, "replied", 'To problems of corruption by', 9.12, -3, true ],
			[ "note", false, "replied", 'Which would simply be awkward in', 12.15, -4, false ]
		];
		model = new dojox.grid.data.table(null, data);
		
		// grid structure
		// a grid view is a group of columns
		// a special view providing selection feedback
		var rowBar = {type: 'dojox.GridRowView', width: '20px'};
		
		// a view without scrollbars
		var leftView = {
			noscroll: false,
			cells: [[
				{name: 'Column 0'},
				{name: 'Column 1'}
		]]};
		
		var middleView = {
			cells: [[
				{name: 'Column 2'},
				{name: 'Column 3'},
				{name: 'Column 4'},
				{name: 'Column 5'},
				{name: 'Column 6'},
		]]};
		
		// a grid structure is an array of views.
		var structure = [ rowBar, leftView, middleView];
		
		// get can return data for each cell of the grid
		function get(inRowIndex) {
			return [this.index, inRowIndex].join(', ');
		}

		dojo.addOnLoad(function(){
			var hand = new dojox.layout.ResizeHandle({
				targetContainer: dojo.byId("bar"),
				animateSizing: false,
				onResize: function(e){
					setTimeout(dojo.hitch(aGrid,"resize",e),25);
				}
			},"hand0");
		});
		
	
</script>
</head>
<body class="tundra">
<div class="heading">dojox.Grid Sizing Test w/ the experimental dojox.layout.ResizeHandle</div>
	
	<p>While this test should work, dojox.layout.ResizeHandle is experimental.</p>
	
	<div id="bar" style="position:relative">
		<div jsId="aGrid" id="grid" dojoType="dojox.Grid" model="model" structure="structure" elasticView="2"></div>
		<div id="hand0"></div>
	</div>
	
	<p>Grid fits to a sized container by default:</p>
	<div id="container" style="position:relative">
		<div jsId="theGrid" id="grid1" dojoType="dojox.VirtualGrid" get="get" structure="structure" rowCount="75" elasticView="2"></div>
		<div id="hand1" dojoType="dojox.layout.ResizeHandle" targetId="container" onResize="setTimeout(dojo.hitch(theGrid,'update'),50)" animateSizing="false"></div>
	</div>
	
	<p>I am here to take up</p>

	<p>space</p>

	<p>as much as needed.</p>
		
</body>
</html>