Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
<html>
3
<head>
4
	<title>dojox.Grid Change Structure Example</title>
5
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
6
	<style type="text/css">
7
		@import "../_grid/Grid.css";
8
		body {
9
			font-size: 0.9em;
10
			font-family: Geneva, Arial, Helvetica, sans-serif;
11
		}
12
		.heading {
13
			font-weight: bold;
14
			padding-bottom: 0.25em;
15
		}
16
 
17
		#grid {
18
			border: 1px solid #333;
19
			width: 48em;
20
			height: 30em;
21
		}
22
 
23
		#grid .dojoxGrid-cell {
24
			text-align: center;
25
		}
26
	</style>
27
	<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:false, parseOnLoad: true"></script>
28
	<script type="text/javascript">
29
		dojo.require("dojox.grid.Grid");
30
		dojo.require("dojox.grid._data.model");
31
		dojo.require("dojo.parser");
32
	</script>
33
	<script type="text/javascript">
34
 
35
		// get can return data for a cell of the grid
36
		function get(inRowIndex) {
37
			return [this.index, inRowIndex].join(', ');
38
		}
39
 
40
		// grid structure
41
		// a grid view is a group of columns
42
 
43
		// a special view providing selection feedback
44
		var rowBar = {type: 'dojox.GridRowView', width: '20px' };
45
 
46
		// a view without scrollbars
47
		var view0 = {
48
			noscroll: true,
49
			cells: [[
50
				{name: 'Alpha', value: '<input name="" type="checkbox" value="0">'},
51
				{name: 'Beta', get: get, width: 4.5}
52
		]]};
53
 
54
		var view1 = {
55
			cells: [[
56
				{name: 'Apple', value: '<button>Apple</button>'},
57
				{name: 'Banana', get: get},
58
				{name: 'Beans', value: 'Happy to be grid!'},
59
				{name: 'Kiwi', get: get},
60
				{name: 'Orange', value: '<img src="images/flatScreen.gif" height="48" width="48">'},
61
				{name: 'Pear', get: get},
62
				{name: 'Tomato', width: 20, value: '<input name="" type="file">'},
63
		]]};
64
 
65
		var view2 = {
66
			noscroll: true,
67
			cells: [
68
				[
69
					{name: 'Alpha', value: '<input name="" type="checkbox" value="0">', rowSpan: 2},
70
					{name: 'Beta', get: get, width: 4.5}
71
				], [
72
					{name: 'Gamma', get: get}
73
				],
74
				[
75
					{name: 'Epsilon', value: '<button>Epsilon</button>', colSpan: 2}
76
				]
77
			]
78
		}
79
 
80
		var view3 = {
81
			cells: [
82
				[
83
					{name: 'Apple', value: '<button>Apple</button>', rowSpan: 3},
84
					{name: 'Banana', get: get, width: 20},
85
					{name: 'Kiwi', get: get, width: 20},
86
					{name: 'Pear', get: get, width: 20},
87
				],
88
				[
89
					{name: 'Beans', value: 'Happy to be grid!'},
90
					{name: 'Orange', value: '<img src="images/flatScreen.gif" height="48" width="48">'},
91
					{name: 'Tomato', value: '<input name="" type="file">'}
92
				], [
93
					{name: 'Zuchini', value: '<span style="letter-spacing: 10em;">wide</span>', colSpan: 3}
94
				]
95
			]};
96
 
97
 
98
		// a grid structure is an array of views.
99
		// By default the middle view will be 'elastic', sized to fit the remaining space left by other views
100
		// grid.elasticView can also be manually set
101
		var structure = [ rowBar, view0, view1 ];
102
		var structure2 = [ rowBar, view2, view3 ];
103
 
104
 
105
		var l2 = false;
106
		toggleStructure = function() {
107
			l2 = !l2;
108
			grid.scrollToRow(0);
109
			grid.setStructure(l2 ? structure2 : structure);
110
		}
111
 
112
		dojo.addOnLoad(function() {
113
			window["grid"] = dijit.byId("grid");
114
		});
115
</script>
116
</head>
117
<body>
118
<div class="heading">dojox.VirtualGrid Change Structure Example</div>
119
<p>
120
	<button onclick="toggleStructure()">Change Structure</button>
121
</p>
122
<div id="grid" dojoType="dojox.VirtualGrid" structure="structure" rowCount="100000" elasticView="2"></div>
123
 
124
</body>
125
</html>