aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/grid/tests/test_grid_layout_borderContainer.html
blob: 8f0d8d775985dae294a0de33ba6348ee3333b5e3 (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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Test dojox.Grid Editing</title>
		<style>
			@import "../_grid/tundraGrid.css";
			@import "../../../dojo/resources/dojo.css";
			@import "../../../dijit/themes/tundra/tundra.css";
			@import "../../../dijit/tests/css/dijitTests.css";

			html, body {
				width: 100%;	/* make the body expand to fill the visible window */
				height: 100%;
				overflow: hidden;	/* erase window level scrollbars */
				padding: 0 0 0 0;
				margin: 0 0 0 0;
			}
		</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("dijit.layout.BorderContainer");
			dojo.require("dijit.layout.ContentPane");
			dojo.require("dojo.parser");
		</script>

		<script type="text/javascript">
			// ==========================================================================
			// Create a data model
			// ==========================================================================
			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 ]
			];
			var rows = 10000;
			for(var i=0, l=data.length; i<rows-l; i++){
				data.push(data[i%l].slice(0));
			}
			model = new dojox.grid.data.Table(null, data);

			// ==========================================================================
			// Grid structure
			// ==========================================================================
			gridLayout = [
				{
					type: 'dojox.GridRowView', width: '20px'
				},
				{
					defaultCell: { width: 8, editor: dojox.grid.editors.Input, styles: 'text-align: right;'  },
					rows: [
						[
							{ name: 'Id', width: 3, get: function(inRowIndex){ return inRowIndex+1;} },
							{ name: 'Priority', styles: 'text-align: center;', editor: dojox.grid.editors.Select, options: ["normal", "note", "important"]},
							{ name: 'Mark', width: 3, styles: 'text-align: center;', editor: dojox.grid.editors.Bool },
							{ name: 'Status', field: 2, styles: 'text-align: center;', editor: dojox.grid.editors.Select, options: [ "new", "read", "replied" ]},
							{ name: 'Message', styles: '', width: '100%' },
							{ name: 'Amount'}
						]
					]
				}
			];
		</script>
	</head>
	<body class="tundra">
<div dojoType="dijit.layout.BorderContainer"  liveSplitters="false" persist="true"
          id="verticalSplitParam" design="headline" style="width: 100%; height: 100%;">

  <div dojoType="dijit.layout.ContentPane" id="mybuttons" region="top" 
            splitter="true"  style="width: 100%; height: 10%;">  

	    <div id="controls">
		     <button onclick="grid.refresh()">Refresh</button>
		     <button onclick="grid.edit.focusEditor()">Focus Editor</button>
		     <button onclick="grid.focus.next()">Next Focus</button>
		     <button onclick="addRow()">Add Row</button>
		     <button onclick="grid.removeSelectedRows()">Remove</button>
		     <button onclick="grid.edit.apply()">Apply</button>
		     <button onclick="grid.edit.cancel()">Cancel</button>
		     <button onclick="grid.singleClickEdit = !grid.singleClickEdit">Toggle singleClickEdit</button>
	    </div>
  </div>

  <div dojoType="dijit.layout.ContentPane" id="gridContainer1" region="center" splitter="true" style="background: red;" > 
	    <div jsId="grid" class="myGrid" 		dojoType="dojox.Grid" model="model" 	structure="gridLayout"></div>
  </div>

</div>

</body>
</html>