ASTreeView Demo:Add, Edit & Delete nodes

简介: <script type="text/javascript"> //選擇節點 OnNodeSelectedScript="nodeSelectHandler(elem);" function nodeSelectHandler(elem){ var val = "selected node:" + elem.parentNode.getAttribut
<script type="text/javascript">
	    //選擇節點 OnNodeSelectedScript="nodeSelectHandler(elem);"
		function nodeSelectHandler(elem){
			var val = "selected node:" + elem.parentNode.getAttribute("treeNodeValue");
			var vals=elem.parentNode.getAttribute("treeNodeValue");
			var valt=elem.innerHTML;//獲取顯示的值
			document.getElementById("<%=divConsole.ClientID %>").innerHTML 
			+= (">>" + val + "<br />");
			document.getElementById("<%=TextBox1.ClientID %>").value = vals;
			document.getElementById("<%=TextBox2.ClientID %>").value = valt;
		}
		//parameter must be "elem"
		function addedHandler( elem ){
			document.getElementById( "<%=divConsole.ClientID %>" ).innerHTML 
			+= ( ">>edit completed. [Node]" + elem.getAttribute("treeNodeValue") 
			+ "<br />" );
		}
		
		//parameter must be "elem"
		function editedHandler( elem ){
			document.getElementById( "<%=divConsole.ClientID %>" ).innerHTML 
			+= ( ">>edit completed. [Node]" + elem.getAttribute("treeNodeValue") 
			+ "<br />" );
		}
		
		//parameter must be "val"
		function deletedHandler( val ){
			document.getElementById( "<%=divConsole.ClientID %>" ).innerHTML 
			+= ( ">>delete completed. [Node]" + val
			+ "<br />" );
		}
		
		//elem is the LI element of each node
		var displayNodeFunc = function( elem ){
			document.getElementById( "<%=divConsole.ClientID %>" ).innerHTML 
			+= ( ">>[Node]" + elem.getAttribute("treeNodeValue") 
			+ " [Parent]:" + elem.parentNode.parentNode.getAttribute("treeNodeValue") 
			+ " [CheckState]:" + elem.getAttribute("checkedState") 
			+ "<br />" );	
		}
	</script>

<ct:ASTreeView ID="astvMyTree" 
							runat="server"
							BasePath="~/Javascript/astreeview/"
							DataTableRootNodeValue="0"
							EnableRoot="false" 
							EnableNodeSelection="true" 
							EnableCheckbox="false" 
							EnableDragDrop="true" 
							EnableTreeLines="true"
							EnableNodeIcon="true"
							EnableCustomizedNodeIcon="false"
							AutoPostBack="false"
							EnableDebugMode="false"
							OnNodeSelectedScript="nodeSelectHandler(elem);"  
							EnableContextMenu="true"
							EnableAjaxOnEditDelete="true"
							EditNodeProvider="~/ASTreeViewRenameNodeHandler.aspx"
							DeleteNodeProvider="~/ASTreeViewDeleteNodeProvider.aspx"
							AddNodeProvider="~/ASTreeViewDemo3.aspx"
							AdditionalAddRequestParameters="{'t':'ajaxAdd'}"
							AddNodePromptDefaultValue="New Node" 
							AddNodePromptMessage="Hello, please add a new node:"
							AddNodeDataValueProvider="return prompt('new ndoe? under:' + elem.getAttribute('treeNodeValue'),'new node name');"
							OnNodeAddedScript="addedHandler(elem)"	
							OnNodeEditedScript="editedHandler(elem)"
							OnNodeDeletedScript="deletedHandler(val)" OnOnSelectedNodeChanged="astvMyTree_OnSelectedNodeChanged"  />

/// <summary>
		/// initial controls, bind you events etc. here
		/// </summary>
		private void InitializeComponent()
		{
            //獲取值 添加右鍵菜單進行編輯
            //this.astvMyTree.ContextMenu.MenuItems.Add(new ASContextMenuItem("獲取 current value", "alert('current value:' + " + this.astvMyTree.ContextMenuClientID + ".getSelectedItem().parentNode.getAttribute('treeNodeValue')" + ");return false;", "otherevent"));
            this.astvMyTree.ContextMenu.MenuItems.Add(new ASContextMenuItem("獲取 current value", "alert('current value:' + " + this.astvMyTree.ContextMenuClientID + ".getSelectedItem().parentNode.getAttribute('treeNodeValue')" + ");window.location.href ='ASTreeViewEdit.aspx?EditNodeValues='+" + this.astvMyTree.ContextMenuClientID + ".getSelectedItem().parentNode.getAttribute('treeNodeValue')" + ";", "otherevent"));
            this.astvMyTree.ContextMenu.MenuItems.Add(new ASContextMenuItem("獲取 current text", "alert('current text:' + " + this.astvMyTree.ContextMenuClientID + ".getSelectedItem().innerHTML" + ");return false;", "otherevent"));
		}

http://www.jinweijie.com/

http://www.astreeview.com/astreeviewdemo/astreeviewdemo1.aspx

目录
相关文章
|
7月前
Each child in a list should have a unique “key“ prop. Check the render method的报错解决
Each child in a list should have a unique “key“ prop. Check the render method的报错解决
Unknown custom element: <add-employee> - did you register the component correctly? For red cursive c
原因: 1.组件名没写对(导入和注册不对应) 2.components少写了个s 3.组件命名最好是驼峰命名 4.导入时语法错误 5.代码中有两个components,后一个的值把前一个覆盖了 6.组件直接循环套用了
106 0
|
8月前
|
Kubernetes 容器
使用kubeadm部署k8s报错:The kubelet is not running或者level=error msg="Handler for POST /v1.43/images/create returned error: Head \"https://us-west2-dock
使用kubeadm部署k8s报错:The kubelet is not running或者level=error msg="Handler for POST /v1.43/images/create returned error: Head \"https://us-west2-dock
|
8月前
|
存储
Build desc failed:Fetch table group shards failed on meta proxy:Loading cached shard 1ocation value for table group[dwhg_scm.dwhg_prd_tg_default] failed
Build desc failed:Fetch table group shards failed on meta proxy:Loading cached shard 1ocation value for table group[dwhg_scm.dwhg_prd_tg_default] failed
218 2
|
SQL 数据库管理 关系型数据库
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
测试环境:OEL6.5+Oracle 11g R2在进行执行计划测试的时候,遇到一个小问题。在用普通用户执行下面这条命令的时候,普通用户名为hhu,已经赋予了create session和resource权限。
1136 1
|
安全
Error Code: 1175. You are using safe update mode and you tried to update a t
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/inforstack/article/details/79677217 在安全模式下,只能根据主键来做修改,所以使用非主键修改,那么将要解除安全模式,然后再执行操作。
1664 0