我试图在Dojo 1.8中获得JsonRest功能。正在加载DataGrid。 我已经让Dojo客户端成功与REST服务器通话。我打电话,我的DataGrid标题被填充,但没有填充数据。来自REST呼叫的响应是...Dojo 1.8 JsonRest和DataGrid
{“data”:{“fundId”:“12345”,“fundDescription”:“高风险股票基金”,“bidPrice”:26.8,“offerPrice”:27.4 “LASTUPDATED”: “2013-01-23T14:13:45”}}
我的道场的代码是...
require([
"dojo/store/JsonRest",
"dojo/store/Memory",
"dojo/store/Cache",
"dojox/grid/DataGrid",
"dojo/data/ObjectStore",
"dojo/query",
"dojo/domReady!"
], function(JsonRest, Memory, Cache, DataGrid, ObjectStore, query) {
var restStore, memoryStore, myStore, dataStore, grid;
restStore = JsonRest({target:"http://localhost:8080/funds/12345"});
memoryStore = new Memory();
myStore = Cache(restStore, memoryStore);
grid = new DataGrid({
store: dataStore = new ObjectStore({objectStore: myStore}),
structure: [
{name:"Fund Id", field:"fundId", width: "200px"},
{name:"Description", field:"fundDescription", width: "200px"},
{name:"Bid Price", field:"bidPrice", width: "100px"},
{name:"Offer Price", field:"offerPrice", width: "100px"},
{name:"Last Updated", field:"lastUpdated", width: "200px"}
]
}, "target-node-id"); // make sure you have a target HTML element with this id
grid.startup();
query("#save").onclick(function(){
dataStore.save();
});
});
我缺少的是让成功加载到网格中的数据?
谢谢......我的回复是由Spring的MVC注释的REST支持的默认实现返回的......我需要查看一下以获得响应,并获得正确的响应。 – mortsahl