Files
openlayers/master/examples/test_data_grid_page_cache.html
Éric Lemoine 5d14b9e2d4 Updated
2013-02-20 10:38:25 +01:00

46 lines
1.8 KiB
HTML

<!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" djconfig="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 jsid="grid1" dojoType="dojox.grid.DataGrid" store="test_store" query="{ id: '*' }" rowsPerPage="10" keepRows="20" structure="layout" style="height: 200px; width: 75%;">
</div>
</body></html>