修改extjs4.1的example里的tree/check-tree例子,希望可以读取指定json节点下的数据,一直不成功,求教
原例子:
js:
var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'check-nodes.json'
},
。。。。以下省略
json:
[{
"text": "To Do",
"cls": "folder",
"expanded": true,
"children": [{
"text": "Go jogging",
"leaf": true,
"checked": true
},{
。。。。以下省略
改为
js:
var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'check-nodes.json',
reader:{
type:'json',
root:'data.record'
}
},
json:
{data:{record:[{
"text": "To Do",
"cls": "folder",
"expanded": true,
"children": [{
"text": "Go jogging",
"leaf": true,
"checked": true
},{
。。。。以下省略
上面的代码将会报错。
之后,我把proxy和reader的创建过程都放到外面手动创建了,都创建成功了,然后就是在创建treestore的时候,把里面的proxy属性指向我创建的proxy对象,就提示treestore创建失败了,希望找一个解决办法,因为我希望返回值能符合我规定的数据格式,以便统一错误信息