1
まず、ここで何をしてくれてどうもありがとう。それはとてもいいです。dojox.grid.EnhancedGridのデータソート
私はDojoを使用してWebアプリケーションを開発していますが、dojox.grid.EnhancedGrid
で行を注文する際に問題が発生しています。私は、グリッド内のデータを入れて、ヘッダをクリックして行の順序を変更したい
[
{"id":1,"name":"Car A","price":"1000","productstatus":{"id":1,"name":"new"}},
{"id":2,"name":"Car B","code":"2000","productstatus":{"id":2,"name":"old"}}
]
:よう のは、私は製品のステータスを持つ製品を持っているとしましょう、私のJSONファイルが見えます。
私は私のHTMLファイル内にあります。
<table id="lstProduct" jsId="lstProduct" dojoType="dojox.grid.EnhancedGrid" >
<thead>
<tr>
<th field="id">Id</th>
<th field="name" width="100px">Name</th>
<th field="price" width="100px">Price</th>
<th field="id" formatter="formatterStatus">Status</th>
</tr>
</thead>
</table>
と私のJavascriptファイル:
dojo.addOnLoad(function() {
productStore = new dojo.data.ItemFileReadStore({data: { items: ${products} }});
dijit.byId("lstProduct").setStore(productStore);
});
// formatter
function formatterStatus(val, rowIndex) {
return lstTasks.getItem(rowIndex)['productstatus'][0]['name'];
}
問題?ステータス(ステータスはname
)で注文できません。ステータスヘッダをクリックすると、注文はproduct.id
になります。
これを回避する方法はありますか? ありがとうございます。