我試圖在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