用coolite开发的项目,也需要用到comboTree,千辛万苦,终于和老外要到了代码。
JS
ComboTree.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Web.UI;
using Coolite.Ext.Web;
[assembly: WebResource("Coolite.Ext.UX.Extensions.ComboTree.resources.ComboTree.js", "text/javascript")]
namespace Coolite.Ext.UX
{
[Designer(typeof(EmptyDesigner))]
[DefaultProperty("")]
[Xtype("combotree")]
[InstanceOf(ClassName = "Ext.ux.ComboTree")]
[ClientScript(Type = typeof(ComboTree), WebResource = "Coolite.Ext.UX.Extensions.ComboTree.resources.ComboTree.js", FilePath = "ux/extensions/combotree/combotree.js")]
[ToolboxData("<{0}:ComboTree runat=\"server\" Title=\"Combo tree\" Height=\"300\"></{0}:ComboTree>")]
[Description("Combobox with tree functionality")]
public class ComboTree : ComboBox
{
private ItemsCollection<TreePanel> tree;
[ClientConfig("tree", typeof(ItemCollectionJsonConverter))]
[Category("Config Options")]
[NotifyParentProperty(true)]
[DefaultValue(null)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual ItemsCollection<TreePanel> Tree
{
get
{
if (this.tree == null)
{
this.tree = new ItemsCollection<TreePanel>();
}
return this.tree;
}
}
protected override void OnLoad(EventArgs e)
{
this.Controls.Add(Tree[0]);
if (!this.LazyItems.Contains(Tree[0]))
{
this.LazyItems.Add(Tree[0]);
}
base.OnLoad(e);
}
}
}