关于Ext Tree树形菜单一次性加载,我在后台返回全部数据,在我点击节点后再次请求后台。这里想要的是我点击节点直接展开下面的子节点,不需要再次请求后台,希望指导下。谢谢。代码如下:
1 var rightsStore = Ext.create('Ext.data.TreeStore', { 2 autoLoad: true,//自动加载 3 4 fields: [ 5 'FuncID', 'ParentFuncID', 'FuncName', 'FuncTitle', 'FuncType', 'PicUrl', 6 'ListOrder', 'HelpUrl', 'Enabled', 'Remark', 'FuncUrl' 7 ],//数据字段 8 proxy: { 9 type: 'ajax', 10 actionMethods: { 11 read: 'post' 12 }, 13 url: '/ASHX/SystemModel/Roles/Roles.ashx?option=GetRights' 14 }, 15 root: { 16 FuncTitle: '系统', 17 FuncID: '', 18 left: false, 19 expanded: true 20 }, 21 listeners: { 22 beforeload: function (treeStore, opration, opt) { 23 24 } 25 } 26 }); 27 var rightsTree = Ext.create('Ext.tree.Panel', { 28 rootVisible: true, 29 displayField: 'FuncTitle', 30 store: rightsStore, 31 useArrows: true, 32 autoScroll: true, 33 animate: true, 34 checked: true, 35 containerScroll: true, 36 listeners: { 37 'itemclick': function (projectTree, record, item, index, e, eOpts) { 38 39 } 40 } 41 }); 42 //创建window 43 Ext.create("Ext.window.Window", { 44 title: "权限设置", 45 id: 'ProjectName', 46 width: 350, 47 height: 400, 48 autoScroll: true, 49 draggable: false, 50 autoDestroy: true, 51 loader: false, 52 modal: true,//遮挡背后一切,只显示当前window 53 layout: "fit", 54 items: [rightsTree] 55 }).show();
后台返回的数据:
1 [{"FuncID":"6a0c3233-c09c-49d4-aa26-d66877482f70","PraentFuncID":" ","FuncTitle":"12323","Children":[{"FuncID":"f624fdae-fe42-42bc-ae40-cfa3823c6f14","PraentFuncID":"6a0c3233-c09c-49d4-aa26-d66877482f70","FuncTitle":"大幅度","Children":null,"leaf":true,"checked":false}],"leaf":false,"checked":true},{"FuncID":"a9882cc2-6b97-4720-94bf-49e76b4eea79","PraentFuncID":" ","FuncTitle":"1232","Children":[],"leaf":true,"checked":false}]
自己已经解决了!~
我是Ext5也遇到了你的问题请问是如何解决的谢谢!!!