0

Dojo 1.6 を使用して単純な DatGrid をレンダリングしています。私が直面した唯一の問題は、 dojo 1.6 DataGrid can't display listsに似ていますか? ここのソリューションとここの参照http://dojotoolkit.org/documentation/tutorials/1.6/store_driven_grid/は実際に機能しましたが、JSON 構造にはまだ 1 つの問題があります。以下は、機能する例と機能しない例です。すべてが項目配列にラップされている形式で JSON を取得しています。どうすれば機能しますか?

動作する json 形式

[{
    "bolist": ["CHM", "CVO", "PMO"],
    "title": "How do I do",
    "painpoints": ["this", "that", "manay more"],
    "solution": "wondeful"
}, {
    "bolist": ["DGM", "EXE", "CLI"],
    "title": "There we go",
    "painpoints": ["Front", "back", "many other places"],
    "solution": "under review"
}]

機能しないjson形式(そして、jsonをこの形式で取得しています)

{"items":[{
    "bolist": ["CHM", "CVO", "PMO"],
    "title": "How do I do",
    "painpoints": ["this", "that", "manay more"],
    "solution": "wondeful"
}, {
    "bolist": ["DGM", "EXE", "CLI"],
    "title": "There we go",
    "painpoints": ["Front", "back", "many other places"],
    "solution": "under review"
}]}
4

1 に答える 1

0

json を JavaScript オブジェクトのように扱うことができます。そこで、jsonReturn.items をグリッドに配信してみてください。そうすれば、グリッドは必要な json データのみを取得します。

[{
    "bolist": ["CHM", "CVO", "PMO"],
    "title": "How do I do",
    "painpoints": ["this", "that", "manay more"],
    "solution": "wondeful"
}, {
    "bolist": ["DGM", "EXE", "CLI"],
    "title": "There we go",
    "painpoints": ["Front", "back", "many other places"],
    "solution": "under review"
}]
于 2013-02-18T11:53:46.720 に答える