Ext.define("MyDesktop.store.commTreeStore",{
extend:"Ext.data.TreeStore",
storeId:"commTreeId",
nodeParam:"id",
fields:[
{name:"id",type:"int"},
{name:"text",type:"string"},
{name:"leaf",type:"auto"}
],
defaultRootId : 'root',
root:{
expanded:true,
children:[
{id:"personalComm",text:"个人通讯簿",leaf:false},
{id:"publicComm",text:"公共通讯簿"}
]
},
proxy:{
type:"ajax",
url:"/OA/findAllDept.action",
reader:{
type:"json",
root:"children"
}
}});这个一个treeStore,当点击公共通讯簿的时候能自动加载下面的节点,,可这个节点的id就是传不过去??
请问该怎么传参数啊
用火狐调试老是显示:id:NaN

解决方案 »

  1.   

    确保json字符串的正确性
    "{'id':'','text':'','children':[{'id':'','text':'','children':[...]}],...}}"记得在值的两端加上单引号,不然会被识别为变量是在不行,可以去掉id配置,只配text看能不能出来,判断是否json字符串有错误,或者将字符串拷贝,在js中用eval解析试试,判断是否格式错误
      

  2.   

    [
    {
    id:'Fruit',text:'Fruit',
    children:[
    {id:'Apple',text:'Apple',
    children:[
    {id:'apple1',text:'apple1',leaf:true},
    {id:'apple2',text:'apple2',leaf:true},
    ]}
    ]
    }
    ]treepanel json格式。