本帖最后由 恒星 于 2012-7-20 05:59 编辑
<ext:Tree ID="tree_menuList" EnableArrows="true"
Width="195px" ShowBorder="false" ShowHeader="false" AutoLeafIdentification="false"
runat="server">
</ext:Tree>
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.IsPostBack)
this.CreateTree();
}
private sysBLL m_sys = new sysBLL();
private void CreateTree()
{
MenuCollection top = this.m_sys.Menu.GetMenuList(1);
this.tree_menuList.Nodes.Clear();
if (top.Count > 0)
{
for (int i = 0; i < top.Count; i++)
{
ExtAspNet.TreeNode node = new ExtAspNet.TreeNode();
node.Text = top.Name;
node.ToolTip = node.Text;
node.NodeID = top.ID.ToString();
node.Icon = Icon.Cmy;
node.CommandName = "top";
node.Target = "_self";
this.tree_menuList.Nodes.Add(node);
}
}
}
protected void tree_menuList_NodeExpand(object sender, ExtAspNet.TreeExpandEventArgs e)
{
this.AddNode(e.Node);
}
private void AddNode(ExtAspNet.TreeNode parentNode)
{
parentNode.Expanded = true;
MenuCollection items = this.m_sys.Menu.GetMenuListByParent(parentNode.NodeID);
if (items.Count > 0)
{
for (int i = 0; i < items.Count; i++)
{
ExtAspNet.TreeNode node = new ExtAspNet.TreeNode();
node.Text = items.Name;
node.ToolTip = node.Text;
node.NodeID = items.ID.ToString();
switch (parentNode.CommandName)
{
case "top":
node.Leaf = false;
node.Target = "_self";
node.Icon = Icon.Cmy;
node.CommandName = "group";
break;
case "group":
node.Leaf = true;
node.Target = "_self";
node.Icon = Icon.Application;
node.CommandName = "item";
break;
}
parentNode.Nodes.Add(node);
}
}
}
点击树前面的箭头可以展开折叠,但是双击节点的时候就报错,怎么解决?!
万分感谢!
错误如下:
行: 1
错误: 无法获取未定义或 null 引用的属性“findParent”
return b?Ext.fly(this.target).findParent(b,a,c)c?Ext.get(this.target):this.target)
|