Dojo 1.8 で JsonRest 機能を取得しようとしています。DataGrid のロードに取り組んでいます。Dojo クライアントが REST サーバーと正常に通信できるようになりました。呼び出しを行います。DataGrid の見出しは入力されていますが、データは入力されていません。REST 呼び出しからの応答は...
{"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();
});
});
データをグリッドに正常にロードするには何が欠けていますか?