Debian Codegraph @

dojox/grid/tests/test_change_structure.html

raw symbols SCIP
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._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 "../resources/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 .dojoxGridCell {
24 text-align: center;
25 }
26 </style>
27 <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:false, parseOnLoad: true"></script>
28 <script type="text/javascript">
29 dojo.require("dijit.dijit");
30 dojo.require("dojox.grid._Grid");
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 view without scrollbars
44 var view0 = {
45 noscroll: true,
46 cells: [
47 {name: 'Alpha', value: '<input name="" type="checkbox" value="0">'},
48 {name: 'Beta', get: get, width: 4.5}
49 ]};
50
51 var view1 = [
52 {name: 'Apple', value: '<button>Apple</button>'},
53 {name: 'Banana', get: get},
54 {name: 'Beans', value: 'Happy to be grid!'},
55 {name: 'Kiwi', get: get},
56 {name: 'Orange', value: '<img src="images/flatScreen.gif" height="48" width="48">'},
57 {name: 'Pear', get: get},
58 {name: 'Tomato', width: 20, value: '<input name="" type="file">'}
59 ];
60
61 var view2 = {
62 noscroll: true,
63 cells: [
64 [
65 {name: 'Alpha', value: '<input name="" type="checkbox" value="0">', rowSpan: 2},
66 {name: 'Beta', get: get, width: 4.5}
67 ],[
68 {name: 'Gamma', get: get}
69 ],[
70 {name: 'Epsilon', value: '<button>Epsilon</button>', colSpan: 2}
71 ]
72 ]
73 }
74
75 var view3 = [
76 [
77 {name: 'Apple', value: '<button>Apple</button>', rowSpan: 3},
78 {name: 'Banana', get: get, width: 20},
79 {name: 'Kiwi', get: get, width: 20},
80 {name: 'Pear', get: get, width: 20}
81 ],[
82 {name: 'Beans', value: 'Happy to be grid!'},
83 {name: 'Orange', value: '<img src="images/flatScreen.gif" height="48" width="48">'},
84 {name: 'Tomato', value: '<input name="" type="file">'}
85 ],[
86 {name: 'Zuchini', value: '<span style="letter-spacing: 10em;">wide</span>', colSpan: 3}
87 ]
88 ];
89
90
91 // a grid structure is an array of views.
92 // By default the middle view will be 'elastic', sized to fit the remaining space left by other views
93 // grid.elasticView can also be manually set
94 var structure = [ view0, view1 ];
95 var structure2 = [ view2, view3 ];
96
97
98 var l2 = false;
99 toggleStructure = function() {
100 l2 = !l2;
101 grid.scrollToRow(0);
102 grid.set('structure', l2 ? structure2 : structure);
103 }
104 </script>
105 </head>
106 <body>
107 <div class="heading">dojox.grid._Grid Change Structure Example</div>
108 <p>
109 <button onclick="toggleStructure()">Change Structure</button>
110 </p>
111 <div id="grid" data-dojo-id="grid" dojoType="dojox.grid._Grid" structure="structure" rowSelector="20px" rowCount="100000" elasticView="2"></div>
112
113 </body>
114 </html>