- JScript code
Ext.regModel("TreeMenu",{ fields:[ {name: 'parentid', type: 'string'}, {name: 'text', type: 'string'} ] }); var store = new Ext.data.TreeStore({ model:'TreeMenu', nodeParam:'parentid', //指定节点参数名 proxy:{ type: 'ajax', url: 'TreeMenu.aspx', reader:'json' }, autoLoad:true, root:{ text:'根节点', parentid:'-1' } }); var treenode = Ext.create('Ext.tree.Panel',{ store: store, columns:[{ xtype:'treecolumn', dataIndex:'text', sortable:true }], width:250, height:150, lines:false, useArrows : true, rootVisible:false, rootVisible: false });
返回JSON数据
- HTML code
[{id:"1",menucode:"xhfp",text:"发票管理",parentid:"0",leaf:false,iconCls:""}, {id:"2",menucode:"tjcx",text:"统计查询",parentid:"0",leaf:false,iconCls:""}, {id:"3",menucode:"jczl",text:"基础资料",parentid:"0",leaf:false,iconCls:""}, {id:"4",menucode:"qxgl",text:"权限管理",parentid:"0",leaf:false,iconCls:""}, {id:"5",menucode:"xtsz",text:"系统设置",parentid:"0",leaf:false,iconCls:""}]
------解决方案--------------------
- C# code
sorters:[{ property:'text', direction:'ASC' }]