<ext:TreePanel
ID="UserTreePanel"
runat="server"
Title="用户结构图"
AutoHeight="true"
Border="false">
<Listeners>
<BeforeLoad Fn="nodeLoad" />
<Click Handler="clickTree1(node);" />
</Listeners></ext:TreePanel>
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
[DirectMethod]
public string NodeLoad(string nodeID)
{
Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection();if (!string.IsNullOrEmpty(nodeID))
{
List<sp_GetUserByReferee_Result> list = _edm.sp_GetUserByReferee(nodeID).ToList();foreach (var item in list)
{
AsyncTreeNode asyncNode = new AsyncTreeNode();
asyncNode.Text = item.User_DisplayName;
asyncNode.NodeID = item.User_Name;
asyncNode.Icon = Icon.User;
nodes.Add(asyncNode);}
}return nodes.ToJson();
}[DirectMethod]
public void ClickTree(string nodeID)
{
if (!string.IsNullOrEmpty(nodeID))
{
XF_User user = _edm.XF_User.First(c => c.User_Name == nodeID);
ucEdit.LoadData(user.Id);
ucEdit.Show();
}
}
ext:TreePanel 动态添加和单击事件