| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>DataGrid Page Cache Test</title> |
| 5 | <style type="text/css"> |
| 6 | @import "../../../dijit/themes/tundra/tundra.css"; |
| 7 | @import "../../../dojo/resources/dojo.css"; |
| 8 | @import "../resources/tundraGrid.css"; |
| 9 | </style> |
| 10 | |
| 11 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:true, parseOnLoad: true"></script> |
| 12 | <script type="text/javascript"> |
| 13 | dojo.require("dojo.parser"); |
| 14 | dojo.require("dojo.data.ItemFileWriteStore"); |
| 15 | dojo.require("dojox.grid.DataGrid"); |
| 16 | </script> |
| 17 | <script type="text/javascript" src="support/test_data.js"></script> |
| 18 | <script type="text/javascript"> |
| 19 | // a grid layout is an array of views. |
| 20 | var layout = [ |
| 21 | [ |
| 22 | { name: 'Column 0', field: 'id' }, |
| 23 | { name: 'Column 1', field: 'col1' }, |
| 24 | { name: 'Column 2', field: 'col2' }, |
| 25 | { name: 'Column 3', field: 'col3', width: '150px' }, |
| 26 | { name: 'Column 4', field: 'col4' } |
| 27 | ], |
| 28 | [ |
| 29 | {name: 'Column 5', field: 'col5' }, |
| 30 | {name: 'Column 6', field: 'col6' }, |
| 31 | {name: 'Column 7', field: 'col7' }, |
| 32 | {name: 'Column 8', field: 'col3', colSpan: 2} |
| 33 | ] |
| 34 | ]; |
| 35 | function query(){ |
| 36 | console.log("There are "+dojo.query(".dojoxGridRow",grid1.domNode).length+" rows created in the grid"); |
| 37 | } |
| 38 | </script> |
| 39 | </head> |
| 40 | <body class="tundra"> |
| 41 | Scroll trough some pages and then count the number of row nodes. We are instantiating the grid with 10 rows per page, and <b>caching at most 20 rows</b>. So if this policy works, you should never see a number bigger than 20! <br> |
| 42 | <button onclick="query()">Get number of row nodes</button> |
| 43 | <div data-dojo-id="grid1" dojoType="dojox.grid.DataGrid" store="test_store" query="{ id: '*' }" rowsPerPage="10" keepRows="20" structure="layout" style="height: 200px; width: 75%;"> |
| 44 | </div> |
| 45 | </body></html> |