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.

46 lines (44 loc) 1.85 kB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>DataGrid Page Cache Test</title> <style type="text/css"> @import "../../../dijit/themes/tundra/tundra.css"; @import "../../../dojo/resources/dojo.css"; @import "../resources/tundraGrid.css"; </style> <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:true, parseOnLoad: true"></script> <script type="text/javascript"> dojo.require("dojo.parser"); dojo.require("dojo.data.ItemFileWriteStore"); dojo.require("dojox.grid.DataGrid"); </script> <script type="text/javascript" src="support/test_data.js"></script> <script type="text/javascript"> // a grid layout is an array of views. var layout = [ [ { name: 'Column 0', field: 'id' }, { name: 'Column 1', field: 'col1' }, { name: 'Column 2', field: 'col2' }, { name: 'Column 3', field: 'col3', width: '150px' }, { name: 'Column 4', field: 'col4' } ], [ {name: 'Column 5', field: 'col5' }, {name: 'Column 6', field: 'col6' }, {name: 'Column 7', field: 'col7' }, {name: 'Column 8', field: 'col3', colSpan: 2} ] ]; function query(){ console.log("There are "+dojo.query(".dojoxGridRow",grid1.domNode).length+" rows created in the grid"); } </script> </head> <body class="tundra"> 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> <button onclick="query()">Get number of row nodes</button> <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%;"> </div> </body></html>