| 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.DataGrid Sizing Example</title> |
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> |
| 7 | <style type="text/css"> |
| 8 | @import "../../../dojo/resources/dojo.css"; |
| 9 | @import "../../../dijit/tests/css/dijitTests.css"; |
| 10 | @import "../resources/Grid.css"; |
| 11 | @import "../resources/tundraGrid.css"; |
| 12 | @import "../../layout/resources/ResizeHandle.css"; |
| 13 | |
| 14 | .heading { |
| 15 | font-weight: bold; |
| 16 | padding-bottom: 0.25em; |
| 17 | } |
| 18 | |
| 19 | #bar, #container { |
| 20 | width: 400px; |
| 21 | height: 200px; |
| 22 | border: 4px double #333; |
| 23 | } |
| 24 | |
| 25 | #grid { |
| 26 | border: 1px solid #333; |
| 27 | } |
| 28 | #grid .dojoxGridScrollbox, |
| 29 | #grid1 .dojoxGridScrollbox { |
| 30 | overflow: scroll; |
| 31 | } |
| 32 | </style> |
| 33 | |
| 34 | <script type="text/javascript" src="../../../dojo/dojo.js" |
| 35 | data-dojo-config="isDebug:false, parseOnLoad: true"></script> |
| 36 | |
| 37 | <script type="text/javascript"> |
| 38 | dojo.require("dojox.grid.DataGrid"); |
| 39 | dojo.require("dojo.data.ItemFileWriteStore"); |
| 40 | dojo.require("dojo.parser"); |
| 41 | dojo.require("dojox.layout.ResizeHandle"); |
| 42 | </script> |
| 43 | <script type="text/javascript" src="support/test_data.js"></script> |
| 44 | <script type="text/javascript"> |
| 45 | var structure = [ |
| 46 | { |
| 47 | noscroll: false, |
| 48 | cells: [ |
| 49 | {name: 'Column 1', field: 'col1'}, |
| 50 | {name: 'Column 2', field: 'col2'} |
| 51 | ] |
| 52 | }, |
| 53 | [ |
| 54 | {name: 'Column 3', field: 'col3'}, |
| 55 | {name: 'Column 4', field: 'col4'}, |
| 56 | {name: 'Column 5', field: 'col5'}, |
| 57 | {name: 'Column 6', field: 'col6'}, |
| 58 | {name: 'Column 7', field: 'col7'} |
| 59 | ] |
| 60 | ]; |
| 61 | |
| 62 | // get can return data for each cell of the grid |
| 63 | function get(inRowIndex) { |
| 64 | return [this.index, inRowIndex].join(', '); |
| 65 | } |
| 66 | |
| 67 | dojo.addOnLoad(function(){ |
| 68 | var hand = new dojox.layout.ResizeHandle({ |
| 69 | targetContainer: dojo.byId("bar"), |
| 70 | animateSizing: false, |
| 71 | onResize: function(e){ |
| 72 | setTimeout(dojo.hitch(aGrid,"update",e),25); |
| 73 | } |
| 74 | },"hand0"); |
| 75 | }); |
| 76 | </script> |
| 77 | </head> |
| 78 | <body class="tundra"> |
| 79 | <div class="heading"> |
| 80 | dojox.grid.DataGrid Sizing Test w/ the experimental dojox.layout.ResizeHandle |
| 81 | </div> |
| 82 | <p>While this test should work, dojox.layout.ResizeHandle is experimental.</p> |
| 83 | |
| 84 | <div id="bar" style="position:relative"> |
| 85 | <div data-dojo-id="aGrid" id="grid" dojoType="dojox.grid.DataGrid" |
| 86 | store="test_store" rowSelector="20px" |
| 87 | structure="structure" elasticView="2"></div> |
| 88 | <div id="hand0"></div> |
| 89 | </div> |
| 90 | |
| 91 | <p>Grid fits to a sized container by default:</p> |
| 92 | <div id="container" style="position:relative"> |
| 93 | <div data-dojo-id="theGrid" id="grid1" dojoType="dojox.grid._Grid" |
| 94 | get="get" rowSelector="20px" structure="structure" |
| 95 | rowCount="75" elasticView="2"></div> |
| 96 | <div id="hand1" dojoType="dojox.layout.ResizeHandle" |
| 97 | targetId="container" onResize="setTimeout(dojo.hitch(theGrid,'update'),50)" |
| 98 | animateSizing="false"></div> |
| 99 | </div> |
| 100 | |
| 101 | <p>I am here to take up</p> |
| 102 | |
| 103 | <p>space</p> |
| 104 | |
| 105 | <p>as much as needed.</p> |
| 106 | |
| 107 | </body> |
| 108 | </html> |