bf7c52e121124af0cb657846453cca97f9c8cd45.svn-base 3.6 KB

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