| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| 2 | "http://www.w3.org/TR/html4/loose.dtd"> |
| 3 | <html> |
| 4 | <head> |
| 5 | <title>dojox.grid.Grid Styling Test</title> |
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> |
| 7 | <style type="text/css"> |
| 8 | @import "../resources/Grid.css"; |
| 9 | body { |
| 10 | font-size: 0.9em; |
| 11 | font-family: Geneva, Arial, Helvetica, sans-serif; |
| 12 | } |
| 13 | .heading { |
| 14 | font-weight: bold; |
| 15 | padding-bottom: 0.25em; |
| 16 | } |
| 17 | |
| 18 | #grid { |
| 19 | border: 1px solid #333; |
| 20 | width: 45em; |
| 21 | height: 30em; |
| 22 | } |
| 23 | |
| 24 | #grid .dojoxGridRow { |
| 25 | border: none; |
| 26 | } |
| 27 | |
| 28 | #grid .dojoxGridRowTable { |
| 29 | border-collapse: collapse; |
| 30 | } |
| 31 | |
| 32 | #grid .dojoxGridCell { |
| 33 | border: none; |
| 34 | padding: 10px; |
| 35 | } |
| 36 | |
| 37 | .selectedRow .dojoxGridCell { |
| 38 | background-color: #003366; |
| 39 | color: white; |
| 40 | } |
| 41 | |
| 42 | .specialRow .dojoxGridCell { |
| 43 | background-color: dimgray; |
| 44 | } |
| 45 | |
| 46 | .selectedRow.specialRow .dojoxGridCell { |
| 47 | text-decoration: line-through; |
| 48 | /* duplicate selection background-color so has precendence over specialRow background-color */ |
| 49 | background-color: #003366; |
| 50 | } |
| 51 | |
| 52 | /* in the yellow column, assign specific decoration for special rows that are selected */ |
| 53 | .selectedRow.specialRow .yellowColumnData { |
| 54 | text-decoration: line-through underline; |
| 55 | } |
| 56 | |
| 57 | .yellowColumn { |
| 58 | color: #006666; |
| 59 | } |
| 60 | |
| 61 | .overRow .dojoxGridCell { |
| 62 | text-decoration: underline; |
| 63 | } |
| 64 | |
| 65 | .greenColumn { |
| 66 | color: yellow; |
| 67 | background-color: #006666; |
| 68 | font-style: italic; |
| 69 | } |
| 70 | .yellowColumnData { |
| 71 | background-color: yellow; |
| 72 | text-decoration: underline; |
| 73 | } |
| 74 | </style> |
| 75 | <script type="text/javascript" src="../../../dojo/dojo.js" |
| 76 | data-dojo-config="isDebug:false, parseOnLoad: true"></script> |
| 77 | <script type="text/javascript"> |
| 78 | dojo.require("dijit.dijit"); |
| 79 | dojo.require("dojox.grid.DataGrid"); |
| 80 | dojo.require("dojo.data.ItemFileWriteStore"); |
| 81 | dojo.require("dojo.parser"); |
| 82 | </script> |
| 83 | <script type="text/javascript" src="support/test_data.js"></script> |
| 84 | <script type="text/javascript"> |
| 85 | var structure = [ |
| 86 | { |
| 87 | // a view without scrollbars |
| 88 | noscroll: true, |
| 89 | cells: [ |
| 90 | {name: 'Column 1', field: 'col1', width: 5, headerStyles: 'padding-bottom: 2px;', styles: 'border-bottom: 1px dashed #333; border-right: 1px dashed #333; padding: 6px;'}, |
| 91 | {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;'} |
| 92 | ] |
| 93 | }, |
| 94 | [ |
| 95 | {name: 'Column 3', field: 'col3'}, |
| 96 | {name: 'Column 4', field: 'col4', headerStyles: 'background-image: none; background-color: #003333;', classes: 'greenColumn'}, |
| 97 | {name: 'Column 5', field: 'col5', cellClasses: 'yellowColumnData', classes: 'yellowColumn', styles: 'text-align: center;' }, |
| 98 | {name: 'Column 6', field: 'col6', headerStyles: 'background-image: none; background-color: #003333;', classes: 'greenColumn'}, |
| 99 | {name: 'Column 7', field: 'col7'}, |
| 100 | {name: 'Column 8', field: 'col8'} |
| 101 | ] |
| 102 | ]; |
| 103 | |
| 104 | function onStyleRow(inRow) { |
| 105 | with (inRow) { |
| 106 | var i = index % 10; |
| 107 | var special = (i > 2 && i < 6); |
| 108 | if (odd) |
| 109 | customStyles += ' color: orange;'; |
| 110 | if (selected) |
| 111 | customClasses += ' selectedRow'; |
| 112 | if (special) |
| 113 | customClasses += ' specialRow'; |
| 114 | if (over) |
| 115 | customClasses += ' overRow'; |
| 116 | if (!over && !selected) |
| 117 | dojox.grid.DataGrid.prototype.onStyleRow.apply(this, arguments); |
| 118 | } |
| 119 | } |
| 120 | </script> |
| 121 | </head> |
| 122 | <body> |
| 123 | <div class="heading">dojox.grid.Grid Styling Example</div> |
| 124 | <div id="grid" data-dojo-id="grid" dojoType="dojox.grid.DataGrid" |
| 125 | onStyleRow="onStyleRow" store="test_store" structure="structure"></div> |
| 126 | </body> |
| 127 | </html> |