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 Styling Test</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: 45em;
|
|
|
20 |
height: 30em;
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
#grid .dojoxGrid-row {
|
|
|
24 |
border: none;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
#grid .dojoxGrid-row-table {
|
|
|
28 |
border-collapse: collapse;
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
#grid .dojoxGrid-cell {
|
|
|
32 |
border: none;
|
|
|
33 |
padding: 10px;
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
.selectedRow .dojoxGrid-cell {
|
|
|
37 |
background-color: #003366;
|
|
|
38 |
color: white;
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
.specialRow .dojoxGrid-cell {
|
|
|
42 |
background-color: dimgray;
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
.selectedRow.specialRow .dojoxGrid-cell {
|
|
|
46 |
text-decoration: line-through;
|
|
|
47 |
/* duplicate selection background-color so has precendence over specialRow background-color */
|
|
|
48 |
background-color: #003366;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
/* in the yellow column, assign specific decoration for special rows that are selected */
|
|
|
52 |
.selectedRow.specialRow .yellowColumnData {
|
|
|
53 |
text-decoration: line-through underline;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
.yellowColumn {
|
|
|
57 |
color: #006666;
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
.overRow .dojoxGrid-cell {
|
|
|
61 |
text-decoration: underline;
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
.greenColumn {
|
|
|
65 |
color: yellow;
|
|
|
66 |
background-color: #006666;
|
|
|
67 |
font-style: italic;
|
|
|
68 |
}
|
|
|
69 |
.yellowColumnData {
|
|
|
70 |
background-color: yellow;
|
|
|
71 |
text-decoration: underline;
|
|
|
72 |
}
|
|
|
73 |
</style>
|
|
|
74 |
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:false, parseOnLoad: true"></script>
|
|
|
75 |
<script type="text/javascript">
|
|
|
76 |
dojo.require("dojox.grid.Grid");
|
|
|
77 |
dojo.require("dojox.grid._data.model");
|
|
|
78 |
dojo.require("dojo.parser");
|
|
|
79 |
</script>
|
|
|
80 |
<script type="text/javascript" src="support/test_data.js"></script>
|
|
|
81 |
<script type="text/javascript">
|
|
|
82 |
// grid structure
|
|
|
83 |
// a grid view is a group of columns
|
|
|
84 |
|
|
|
85 |
// a view without scrollbars
|
|
|
86 |
var leftView = {
|
|
|
87 |
noscroll: true,
|
|
|
88 |
cells: [[
|
|
|
89 |
{name: 'Column 0', width: 5, headerStyles: 'padding-bottom: 2px;', styles: 'border-bottom: 1px dashed #333; border-right: 1px dashed #333; padding: 6px;'},
|
|
|
90 |
{name: 'Column 1', width: 5, headerStyles: 'padding-bottom: 2px;', styles: 'text-align: right; border-bottom: 1px dashed #333; border-right: 1px dashed #333; padding: 6px;'}
|
|
|
91 |
]]};
|
|
|
92 |
|
|
|
93 |
var middleView = {
|
|
|
94 |
cells: [[
|
|
|
95 |
{name: 'Column 2'},
|
|
|
96 |
{name: 'Column 3', headerStyles: 'background-image: none; background-color: #003333;', classes: 'greenColumn'},
|
|
|
97 |
{name: 'Column 4', cellClasses: 'yellowColumnData', classes: 'yellowColumn', styles: 'text-align: center;' },
|
|
|
98 |
{name: 'Column 5', headerStyles: 'background-image: none; background-color: #003333;', classes: 'greenColumn'},
|
|
|
99 |
{name: 'Column 6'},
|
|
|
100 |
{name: 'Column 7'},
|
|
|
101 |
]]};
|
|
|
102 |
|
|
|
103 |
// a grid structure is an array of views.
|
|
|
104 |
var structure = [ leftView, middleView ];
|
|
|
105 |
|
|
|
106 |
function onStyleRow(inRow) {
|
|
|
107 |
with (inRow) {
|
|
|
108 |
var i = index % 10;
|
|
|
109 |
var special = (i > 2 && i < 6);
|
|
|
110 |
if (odd)
|
|
|
111 |
customStyles += ' color: orange;';
|
|
|
112 |
if (selected)
|
|
|
113 |
customClasses += ' selectedRow';
|
|
|
114 |
if (special)
|
|
|
115 |
customClasses += ' specialRow';
|
|
|
116 |
if (over)
|
|
|
117 |
customClasses += ' overRow';
|
|
|
118 |
if (!over && !selected)
|
|
|
119 |
dojox.Grid.prototype.onStyleRow.apply(this, arguments);
|
|
|
120 |
}
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
dojo.addOnLoad(function() {
|
|
|
124 |
window["grid"] = dijit.byId('grid');
|
|
|
125 |
});
|
|
|
126 |
</script>
|
|
|
127 |
</head>
|
|
|
128 |
<body>
|
|
|
129 |
<div class="heading">dojox.Grid Styling Example</div>
|
|
|
130 |
<div id="grid" dojoType="dojox.Grid" onStyleRow="onStyleRow" model="model" structure="structure"></div>
|
|
|
131 |
</body>
|
|
|
132 |
</html>
|