128 lines
3.7 KiB
HTML
128 lines
3.7 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<title>dojox.grid.Grid Styling Test</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
|
|
<style type="text/css">
|
|
@import "../resources/Grid.css";
|
|
body {
|
|
font-size: 0.9em;
|
|
font-family: Geneva, Arial, Helvetica, sans-serif;
|
|
}
|
|
.heading {
|
|
font-weight: bold;
|
|
padding-bottom: 0.25em;
|
|
}
|
|
|
|
#grid {
|
|
border: 1px solid #333;
|
|
width: 45em;
|
|
height: 30em;
|
|
}
|
|
|
|
#grid .dojoxGridRow {
|
|
border: none;
|
|
}
|
|
|
|
#grid .dojoxGridRowTable {
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
#grid .dojoxGridCell {
|
|
border: none;
|
|
padding: 10px;
|
|
}
|
|
|
|
.selectedRow .dojoxGridCell {
|
|
background-color: #003366;
|
|
color: white;
|
|
}
|
|
|
|
.specialRow .dojoxGridCell {
|
|
background-color: dimgray;
|
|
}
|
|
|
|
.selectedRow.specialRow .dojoxGridCell {
|
|
text-decoration: line-through;
|
|
/* duplicate selection background-color so has precendence over specialRow background-color */
|
|
background-color: #003366;
|
|
}
|
|
|
|
/* in the yellow column, assign specific decoration for special rows that are selected */
|
|
.selectedRow.specialRow .yellowColumnData {
|
|
text-decoration: line-through underline;
|
|
}
|
|
|
|
.yellowColumn {
|
|
color: #006666;
|
|
}
|
|
|
|
.overRow .dojoxGridCell {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.greenColumn {
|
|
color: yellow;
|
|
background-color: #006666;
|
|
font-style: italic;
|
|
}
|
|
.yellowColumnData {
|
|
background-color: yellow;
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|
|
<script type="text/javascript" src="../../../dojo/dojo.js"
|
|
djConfig="isDebug:false, parseOnLoad: true"></script>
|
|
<script type="text/javascript">
|
|
dojo.require("dijit.dijit");
|
|
dojo.require("dojox.grid.DataGrid");
|
|
dojo.require("dojo.data.ItemFileWriteStore");
|
|
dojo.require("dojo.parser");
|
|
</script>
|
|
<script type="text/javascript" src="support/test_data.js"></script>
|
|
<script type="text/javascript">
|
|
var structure = [
|
|
{
|
|
// a view without scrollbars
|
|
noscroll: true,
|
|
cells: [
|
|
{name: 'Column 1', field: 'col1', width: 5, headerStyles: 'padding-bottom: 2px;', styles: 'border-bottom: 1px dashed #333; border-right: 1px dashed #333; padding: 6px;'},
|
|
{name: 'Column 2', field: 'col2', width: 5, headerStyles: 'padding-bottom: 2px;', styles: 'text-align: right; border-bottom: 1px dashed #333; border-right: 1px dashed #333; padding: 6px;'}
|
|
]
|
|
},
|
|
[
|
|
{name: 'Column 3', field: 'col3'},
|
|
{name: 'Column 4', field: 'col4', headerStyles: 'background-image: none; background-color: #003333;', classes: 'greenColumn'},
|
|
{name: 'Column 5', field: 'col5', cellClasses: 'yellowColumnData', classes: 'yellowColumn', styles: 'text-align: center;' },
|
|
{name: 'Column 6', field: 'col6', headerStyles: 'background-image: none; background-color: #003333;', classes: 'greenColumn'},
|
|
{name: 'Column 7', field: 'col7'},
|
|
{name: 'Column 8', field: 'col8'}
|
|
]
|
|
];
|
|
|
|
function onStyleRow(inRow) {
|
|
with (inRow) {
|
|
var i = index % 10;
|
|
var special = (i > 2 && i < 6);
|
|
if (odd)
|
|
customStyles += ' color: orange;';
|
|
if (selected)
|
|
customClasses += ' selectedRow';
|
|
if (special)
|
|
customClasses += ' specialRow';
|
|
if (over)
|
|
customClasses += ' overRow';
|
|
if (!over && !selected)
|
|
dojox.grid.DataGrid.prototype.onStyleRow.apply(this, arguments);
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="heading">dojox.grid.Grid Styling Example</div>
|
|
<div id="grid" jsid="grid" dojoType="dojox.grid.DataGrid"
|
|
onStyleRow="onStyleRow" store="test_store" structure="structure"></div>
|
|
</body>
|
|
</html>
|