我写了一个简单的主页面,没有html代码,当前都是extjs。页面加载的时候,执行了一个extjs函数Ext.onReady(function () {Layout();GetRight();});Layout()是页面布局函数,具体就不写了,他里边使用了Ext.container.Viewport 控件,布局了页面,并且包含一个treepanel树形结构控件,该控件我给了一个id,trpl;GetRight是一个获取权限树函数。从后台得到了一个完整的ext.net.treenode对象控件。当前已经成功得到了该返回值,(不知道extjs能否识别这个C# 对象)。当前问题是,怎么根据id得到那个布局中的treepanel,让treepanel的根节点接上返回的这个nodeGetRight函数如下:function GetRight() {Ext.Ajax.request({url: 'Main.aspx',method: 'POST',params: { type: 'Getright' },success: function (response) {var trn = response;var root = Ext.getCmp('trpl').getRootNode();root.appendChild(trn);},failure: function (response, options) {Ext.MessageBox.alert('获取菜单失败', response.status);}});}response就是那个返回的ext.net.treenode对象,前台得到后,直接加到trpl的根节点下。
1 回答

蛊毒传说
TA贡献1895条经验 获得超3个赞
火狐下debug 一下: var trpl=Ext.getCmp('trpl');
再看看trpl能不能取到,再看一下方法getRootNode();有没有写错;
添加回答
举报
0/150
提交
取消