标签:des style c class blog code
<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 |
<ext:XScript ID= "XScript1"
runat= "server" > <script> var
nodeLoad = function (node) { #{DirectMethods}.NodeLoad(node.id, { success: function
(result) { var
data = eval( "("
+ result + ")" ); node.loadNodes(data); }, failure: function
(errorMsg) { Ext.Msg.alert( ‘Failure‘ , errorMsg); } }); } var
clickTree1 = function
(node) { #{DirectMethods}.ClickTree(node.id); } </script> </ext:XScript> |
[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 动态添加和单击事件,布布扣,bubuko.com
标签:des style c class blog code
原文地址:http://www.cnblogs.com/spencerai/p/3753854.html