Dojo1.7.1dojo.store.JsonRestを使用してEnhancedGridにデータを入力しています。ただし、Firebugを使用すると、起動時もアフターワートのフィルタリング時にも送信されたクエリは表示されません。テーブルは空のままです。
概要: 拡張グリッドとJsonRestストアが宣言的に作成されます。ストアは、1つの要素を持つJson配列を返すGET機能のみを備えたRESTサービスを使用するように構成されています。ボタンはグリッドフィルター関数を呼び出して、起動後にクエリが送信されるかどうかをテストします。
サービスは、次のような静的なJson文字列を返します。
[{id:'1',firstname:'John',lastname:'Doe'}]
ソースコードはここにあります:
<html>
<head>
<title>Rest Test</title>
<style type="text/css">
@import "js/dojo/resources/dojo.css";
@import "js/dijit/themes/claro/claro.css";
@import "js/dojox/grid/enhanced/resources/claro/EnhancedGrid.css";
@import "js/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css";
</style>
<script type="text/javascript"
src="js/dojo/dojo.js"
data-dojo-config="parseOnLoad:true"></script>
<script type="text/javascript">
dojo.require("dijit.form.Button");
dojo.require("dijit.form.TextBox");
dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojox.grid.enhanced.plugins.DnD");
dojo.require("dojox.grid.enhanced.plugins.NestedSorting");
dojo.require("dojox.grid.enhanced.plugins.IndirectSelection");
dojo.require("dojo.store.JsonRest");
dojo.addOnLoad(function(){
dojo.connect(dijit.byId("filterButton"),"onClick",function(){
dijit.byId("nameTable").filter("*",true);
});
});
</script>
</head>
<body class="claro">
<button id="filterButton"
data-dojo-type="dijit.form.Button">
Filter Table
</button>
<span id="nameStore"
data-dojo-type="dojo.store.JsonRest"
data-target="http://localhost:8080/MyApp/rest/service3"/>
<table id="nameTable"
style="height:200px;"
data-store="nameStore"
data-dojo-type="dojox.grid.EnhancedGrid"
data-dojo-props="plugins:{dnd: true, nestedSorting: true, indirectSelection: true}" >
<thead>
<tr>
<th data-field="id" width="5%">ID</th>
<th data-field="firstname" width="45%">Vorname</th>
<th data-field="lastname" width="50%">Nachname</th>
</tr>
</thead>
</table>
</body>
</html>
Restful Webサービスは初めてですが、これを解決するためのサポートをいただければ幸いです。