dGrid Test Page
https://github.com/SitePen/dgrid
by schlomm
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8/dijit/themes/claro/claro.css">
<script src="http://amd.egoworx.com/jsfiddle-dojo-require.js"></script>
<h1> Unempty observed store (working: new line after 2 seconds) </h1>
<div id="grid_working_node"></div>
<h1> Empty observed store (problem: no new line after 2 seconds) </h1>
<div id="grid_problem_node"></div>
CSS
html, body {
height: 100%;
width: 100%;
}
JavaScript
require([
"dojo/ready",
"dojo/store/Memory",
"dojo/store/Observable",
"dgrid/OnDemandGrid"
], function (ready, Memory, Observable, OnDemandGrid) {
ready(function () {
store_working = Observable(Memory({
idProperty: "id",
data: [{id: 1}, {id: 2}]
}));
store_empty = Observable(Memory({
idProperty: "id",
data: []
}));
grid_working = new OnDemandGrid({
columns: {id: "ID"},
store: store_working
}, "grid_working_node");
grid_problem = new OnDemandGrid({
columns: {id: "ID"},
store: store_empty
}, "grid_problem_node");
setTimeout(function () {
console.log("put item to observed store_working");
store_working.put({id: 42});
console.log("did item arrive in 'store_working'?", store_working.data);
}, 2000);
setTimeout(function () {
console.log("put item to observed store_empty");
store_empty.put({id: 42});
console.log("did item arrive in 'store_empty'?", store_empty.data);
}, 2000);
});
});