Extjs 为什么树存储上的同步不是嵌套节点
我使用的是一个带有treestore的treepanel和带有3层节点的treemodel。我想向存储添加节点,然后通过服务器api同步存储。对于嵌套存储的读取来说,一切都很好。下面是我向服务器api发送get时的数据示例:Extjs 为什么树存储上的同步不是嵌套节点,extjs,Extjs,我使用的是一个带有treestore的treepanel和带有3层节点的treemodel。我想向存储添加节点,然后通过服务器api同步存储。对于嵌套存储的读取来说,一切都很好。下面是我向服务器api发送get时的数据示例: { "children" : [{ "region" : 1, "label" : "Paris", "children" : [{ "schoolId" : 1,
{
"children" : [{
"region" : 1,
"label" : "Paris",
"children" : [{
"schoolId" : 1,
"type" : "elementry"
"address" : "1 rue generale",
"children" : [{
"classId" : 1,
"teacher" : "Smith",
"year" : 1,
"leaf" : true
}, {
"classId" : 2,
"teacher" : "Alan",
"year" : 1,
"leaf" : true
}, {
"classId" : 3,
"teacher" : "Larkin",
"year" : 2,
"leaf" : true
}, {
"classId" : 4,
"teacher" : "Sharp",
"year" : 2,
"leaf" : true
}
]
}, {
"schoolId" : 2,
"type" : "elementry"
"address" : "1 rue de gaulle",
"children" : [{
"classId" : 5,
"teacher" : "Mathew",
"year" : 1,
"leaf" : true
}, {
"classId" : 6,
"teacher" : "Mark",
"year" : 1,
"leaf" : true
}, {
"classId" : 7,
"teacher" : "Luke",
"year" : 2,
"leaf" : true
}, {
"classId" : 8,
"teacher" : "John",
"year" : 2,
"leaf" : true
}
]
}, {
"schoolId" : 3,
"type" : "middle"
"address" : "99 avenue de larre",
"children" : [{
"classId" : 7,
"teacher" : "Lisa",
"year" : 5,
"leaf" : true
}, {
"classId" : 8,
"teacher" : "Bart",
"year" : 6,
"leaf" : true
}]
}]
}]
}
但是,当我添加子节点并发送sync命令时,生成的post请求不是嵌套的。附加子节点的代码:
var store = me.getViewModel().getStore('schoolStore');
var region = new WEBI.model.Region({
"label" :"Bordeaux"
});
var school = new WEBI.model.School({
"type" : "elementry",
"address" : "10 rue Bidart"
});
region.appendChild(school);
store.root.appendChild(region);
store.sync();
post请求中的数据采用以下格式:
[{
"label" : "Bordeaux"
"region" : "Region-1",
"parentId" : "root",
"leaf" : false
}, {
"type" : "elementry",
"address" : "10 rue Bidart"
"idtsl2" : "School-1",
"parentId" : "Region-1",
"leaf" : false
}]
我期待/希望post请求将嵌套ITME(具有以下格式)
[{
"label" : "Bordeaux"
"region" : "Region-1",
"parentId" : "root",
"leaf" : false,
"children" : [{
"type" : "elementry",
"address" : "10 rue Bidart"
"idtsl2" : "School-1",
"parentId" : "Region-1",
"leaf" : false
}
]
}]
还有其他人看到过同样的问题吗。这是一个必须处理此格式的post请求的问题,还是有某种方法可以配置我的代理/模型以嵌套格式发送post