私は子要素を持つJsonデータを持っています。私はストアを編集可能なグリッドにバインドし、編集内容をストアに移入させる必要があります。 データツリーがItemFileWriteStoreに読み込まれます。データグリッドは親データのみを表示し、子データは表示しません。階層型JsonをItemFileWriteStoreにマップする方法は?
SAMPLE.TXT
{
"items": [
{
"profileId": "1",
"profileName": "ABC",
"profileType": "EmailProfile",
"profilePreferences": [
{
"profilePreferenceId": "1",
"displayText": "Bob",
"address": "[email protected]"
},
{
"profilePreferenceId": "2",
"displayText": "Sally",
"address": "[email protected]"
},
{
"profilePreferenceId": "3",
"displayText": "Joe",
"address": "[email protected]"
}
]
}
]
}
あなたはすべてのも空白のプロファイル名を持つ行提示するdojox.grid.TreeGridか '偽' JSONを使用する必要がjavascriptの
var sampleLayout = [
[
{ field: 'profileName', name: 'profileName', width: '100px' },
{ field: 'profilePreferences.displayText', name: 'displayText', width: '100px' },
{ field: 'profilePreferences.address', name: 'address', width: '100px' }
]];
function populateGrid() {
var url = "sample.txt"; //Will be replaced with endpoint URL
dojo.xhrGet({
handleAs: 'json',
url: url,
error: function (e) {
alert("Error: " + e.message);
},
load: showJsonData
});
}
function showJsonData(response, ioArgs) {
var profileStore = new dojo.data.ItemFileWriteStore({
data: {
items: response.items
}
});
var sampleGrid = dijit.byId("sampleGrid");
sampleGrid.store = profileStore;
sampleGrid.startup();
}
表示はどのように見えますか? (ネストされた行は別のクラス名でフラット化されます) – fncomp
ディスプレイは、3つの列(profileName、displayText、address)を持つグリッドにフラット化する必要があります。グリッドには3つの行があります。 profilePreferencesごとに1つ。 –