I am encountering an issue with making my Dojo EnhancedGrid editable. Currently, I am able to double click on the grid cells and change the value, but when I try to save the new value or leave the cells, I receive an "assertion failed in ItemFileWriteStore" error in Firebug.
Below is the source code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
</style>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css" />
<style type="text/css">
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/Grid.css";
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojox/grid/resources/claroGrid.css";
.dojoxGrid table { margin: 0; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig="parseOnLoad: true">
</script>
<script type="text/javascript">
dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojox.grid.cells._base");
dojo.addOnLoad(function() {
var layoutabc =
[[
{
field: "title",
name: "TitleofMovie",
width: "300px",
editable: true
},
{
field: "year",
name: "Year",
width: "200px",
editable: true
},
{
field: "producer",
name: "Producer",
width: "auto",
editable: true,
type: dojox.grid.cells.Cell
}
]];
var mystore = new dojo.data.ItemFileWriteStore({
url: "movies.json"
});
// create a new grid:
var grid = new dojox.grid.EnhancedGrid(
{
query: {},
store: mystore,
structure: layoutabc
},
document.createElement("div")
);
dojo.byId("gridDiv").appendChild(grid.domNode);
grid.startup();
});
</script>
</head>
<body class="claro">
<div id="gridDiv" style="width: 800px; height: 400px;">
</div>
</body>
This is the content of my movies.json (the data may seem odd, but it's just for testing purposes):
{
items:
[
{
title: "Africa",
year: "continent",
producer: "Katia Lund"
},
{
title: "Kenya",
year: "country",
producer: "Christine Jeffs"
},
{
title: "Mombasa",
year: "city",
producer: "Ridley Scott"
}
]
}