<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8">
|
<title>Test performance on a (simulated) slow network</title>
|
<meta name="viewport" content="width=570">
|
<style>
|
@import "../../dojo/resources/dojo.css";
|
@import "../css/dgrid.css";
|
@import "../css/skins/tundra.css";
|
.heading {
|
font-weight: bold;
|
margin-left: 12px;
|
padding-bottom: 0.25em;
|
}
|
.dgrid {
|
margin: 10px;
|
}
|
/* this is not part of theme, but you can add odd-even coloring this way*/
|
.dgrid-row-odd {
|
background: #F2F5F9;
|
}
|
|
#grid {
|
width: 68em;
|
height: 50em;
|
padding: 1px;
|
}
|
</style>
|
<script src="../../dojo/dojo.js"
|
data-dojo-config="async: true"></script>
|
<script>
|
require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Selection", "dgrid/Keyboard", "dojo/_base/declare", "dgrid/test/data/testPerformanceStore", "dgrid/test/data/createAsyncStore", "dojo/domReady!"],
|
function(List, Grid, Selection, Keyboard, declare, testPerformanceStore, createAsyncStore){
|
var columns = [
|
{ name: 'Column 0', field: 'id', width: '10%' },
|
{ name: 'Column 1', field: 'integer', width: '10%' },
|
{ name: 'Column 2', field: 'floatNum', width: '10%' },
|
{ name: 'Column 3', field: 'date', width: '10%' },
|
{ name: 'Column 4', field: 'date2', width: '10%' },
|
{ name: 'Column 5', field: 'text', width: '10%' },
|
{ name: 'Column 6', field: 'bool', width: '10%' },
|
{ name: 'Column 7', field: 'bool2', width: '10%' },
|
{ name: 'Column 8', field: 'price', width: '10%' },
|
{ name: 'Column 9', field: 'today', width: '10%' }
|
];
|
|
var selection = {};
|
for(var i = 0; i < 20000; i += 10)
|
selection[i] = true;
|
|
var start = new Date().getTime();
|
window.grid = new (declare([Grid, Selection, Keyboard]))({
|
collection: createAsyncStore({ data: testPerformanceStore.data, delay: 500 }),
|
columns: columns,
|
selection: selection,
|
deselectOnRefresh: false
|
}, "grid");
|
console.log(new Date().getTime() - start);
|
|
grid.on("dgrid-refresh-complete", function() {
|
console.log("Refresh completed");
|
});
|
});
|
|
</script>
|
</head>
|
<body class="tundra">
|
<div>Test refresh while preserving scroll position:
|
<button onclick="grid.refresh({keepScrollPosition:1})">refresh</button>
|
</div>
|
<h2 class="heading">Tests handling of large data sets on a (simulated) slow network, with results being returned
|
after a delay and out of order, and the total number of rows being returned at a different
|
time to the result set.</h2>
|
<div id="grid"></div>
|
</body>
|
</html>
|