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

68 lines
2.0 KiB
HTML

<!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 Notification</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, #grid2 {
width: 65em;
height: 25em;
padding: 1px;
}
</style>
<script type="text/javascript" src="../../../dojo/dojo.js"
djConfig="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");
</script>
<script type="text/javascript" src="support/test_data.js"></script>
</head>
<body class="tundra">
<div class="heading">dojox.grid.DataGrid Notification Test</div>
<button onclick="updateCountryTypes();">Change country types</button>
<script>
function updateCountryTypes(){
// get everything starting with "A"
jsonStore.fetch({
query: { name: "A*" },
onComplete: function(items, result){
// change 'em!
dojo.forEach(items, function(item){
jsonStore.setValue(item, "type", "thinger");
// console.debug(item);
});
}
});
}
</script>
<span dojoType="dojo.data.ItemFileWriteStore"
jsId="jsonStore" url="../../../dijit/tests/_data/countries.json">
</span>
<table dojoType="dojox.grid.DataGrid"
jsid="grid" id="grid"
store="jsonStore" query="{ name: '*' }" rowsPerPage="20" rowSelector="20px">
<thead>
<tr>
<th field="name" width="300px">Country/Continent Name</th>
<th field="type" width="auto">Type</th>
</tr>
</thead>
</table>
</body>
</html>