UNPKG

dojox

Version:

Dojo eXtensions, a rollup of many useful sub-projects and varying states of maturity – from very stable and robust, to alpha and experimental. See individual projects contain README files for details.

84 lines (81 loc) 2.87 kB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Test dojox.grid.DataGrid Automatic Width</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> <style type="text/css"> @import "../../../dojo/resources/dojo.css"; @import "../resources/Grid.css"; @import "../resources/tundraGrid.css"; body { font-size: 0.9em; font-family: Geneva, Arial, Helvetica, sans-serif; } .heading { font-weight: bold; padding-bottom: 0.25em; } .grid { width: 85%; height: 20em; padding: 1px; } </style> <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="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"); dojo.addOnLoad(function(){ // A quick-and-dirty resize of the grid when the window resizes to // test that percentages "stick" when they are supposed to. dojo.connect(window, "resize", grid2, "resize"); }); </script> <script type="text/javascript" src="support/test_data.js"></script> </head> <body class="tundra"> <div class="heading">dojox.grid.DataGrid Automatic Width Test</div> <span dojoType="dojo.data.ItemFileWriteStore" data-dojo-id="jsonStore" url="../../../dijit/tests/_data/countries.json"> </span> <table dojoType="dojox.grid.DataGrid" data-dojo-id="grid" id="grid" class="grid" autoWidth="true" store="jsonStore" query="{ name: '*' }" rowsPerPage="20" rowSelector="20px"> <thead> <tr> <th field="name" width="30em">Country/Continent Name</th> <th field="type" width="10em">Type</th> <th field="population" width="10em">Population</th> </tr> </thead> </table> <div class="heading">Auto Width with % column widths (and fixed initial grid width)</div> <table dojoType="dojox.grid.DataGrid" data-dojo-id="grid1" id="grid1" class="grid" autoWidth="true" initialWidth="50em" store="jsonStore" query="{ name: '*' }" rowsPerPage="20" rowSelector="20px"> <thead> <tr> <th field="name" width="50%">Country/Continent Name</th> <th field="type" width="25%">Type</th> <th field="population" width="25%">Population</th> </tr> </thead> </table> <div class="heading">Auto Width with % column widths (and % initial grid width)</div> <table dojoType="dojox.grid.DataGrid" data-dojo-id="grid2" id="grid2" class="grid" autoWidth="true" initialWidth="85%" store="jsonStore" query="{ name: '*' }" rowsPerPage="20" rowSelector="20px"> <thead> <tr> <th field="name" width="50%">Country/Continent Name</th> <th field="type" width="25%">Type</th> <th field="population" width="25%">Population</th> </tr> </thead> </table> </body> </html>