1. treeStore的C#类对象
public class ExtTreeNode { string id; string text; string icon; string url; bool leaf; bool expanded; List<ExtTreeNode> children = new List<ExtTreeNode>(); }
2. Ext.tree
Ext.onReady(function () { //數據源 var store = Ext.create('Ext.data.TreeStore', { proxy: { type: 'ajax', url: '../API/bbs/Default.ashx?API=menu' } }); //树形配置 treePanel = Ext.create('Ext.tree.Panel', { id: "TreeMenu", renderTo: 'basicTree', width: 300, store: store, minSize: 150, maxHeight:'100%;', autoScroll: true, rootVisible: false, singleExpand: false, collapsible: false, lines: true, split: true, listeners: { //鼠标右键 itemcontextmenu: function (node, record, items, index, e) { var nodemenu = Ext.create('Ext.menu.Menu', {items: [{text: '權限管理',handler: function () {}},{text: '增加子節點',handler: function () { }}]}); //取得鼠标点击坐标,展示菜单 nodemenu.showAt(e.getXY()); }, //鼠标单击 itemclick: function (node, record, index, e) {}, //鼠标双击 itemdblclick:function(){} } }); });