我正在尝试按照此处的教程进行操作:
http://dojotoolkit.org/documentation/tutorials/1.7/store_driven_grid/
教程写道:
require(["dojo/store/JsonRest"], function(JsonRest){
myStore = new JsonRest({target:"MyData/"});
我的 MyData.json 文件放在 ROOT\MyData 中。如果我运行以下代码
...
<script>
var myStore, dataStore, grid;
require(["dojo/store/JsonRest"], function(JsonRest){
myStore = new JsonRest({target:"MyData/"});
});
require(["dojox/grid/DataGrid",
"dojo/data/ObjectStore",
"dojo/domReady!"
], function(DataGrid, ObjectStore){
grid = new DataGrid({
store: dataStore = ObjectStore({objectStore: myStore}),
structure: [
{name:"State Name", field:"name", width: "200px"},
{name:"Abbreviation", field:"abbreviation", width: "200px"}
]
}, "target-node-id"); // make sure you have a target HTML element with this id
grid.startup();
});
</script>
...
如果我写“MyData/”,我会在数据上收到 404 错误,如果我写“MyData/MyData.json”,则会收到 416(请求的范围不满足)。
我知道这完全是愚蠢的,因为我找不到任何人有同样的问题,但我看不到解决方案:/
最好的问候,并感谢您的帮助!
安德烈亚斯