📄 radtreeview.js
字号:
var RadTreeView_KeyboardHooked= false; var RadTreeView_Active=null; var RadTreeView_DragActive=null; var RadTreeView_MouseMoveHooked= false; var RadTreeView_MouseUpHooked= false; var RadTreeView_MouseY=0; var RadTreeViewGlobalFirstParam=null; var RadTreeViewGlobalSecondParam=null; var RadTreeViewGlobalThirdParam=null; var contextMenuToBeHidden=null; function RadTreeNode(){ this.Parent=null; this.TreeView=null; this.Nodes=new Array(); this.ID=null; this.ClientID=null; this.SignImage=null; this.SignImageExpanded=null; this.Image=0; this.ImageExpanded=0; this.Action=null; this.Index=0; this.Level=0; this.Text=null; this.Value=null; this.Category=null; this.NodeCss=null; this.NodeCssOver=null; this.NodeCssSelect=null; this.ContextMenuName=null; this.Enabled= true; this.Expanded= false; this.Checked= false; this.Selected= false; this.DragEnabled=1; this.DropEnabled=1; this.EditEnabled=1; this.ExpandOnServer=0; this.IsClientNode=0; this.Attributes=new Array(); this.O= false; } ; RadTreeNode.prototype.Next= function (){var o=(this.Parent!=null)?this.Parent.Nodes: this.TreeView.Nodes; return (this.Index>=o.length)?null:o[this.Index+1]; } ; RadTreeNode.prototype.Prev= function (){var o=(this.Parent!=null)?this.Parent.Nodes: this.TreeView.Nodes; return (this.Index<=0)?null:o[this.Index-1]; } ; RadTreeNode.prototype.NextVisible= function (){if (this.Expanded)return this.Nodes[0]; if (this.Next()!=null)return this.Next(); var I=this ; while (I.Parent!=null){if (I.Parent.Next()!=null)return I.Parent.Next(); I=I.Parent; }return null; } ; RadTreeNode.prototype.PrevVisible= function (){if (this.Prev()!=null){return this.Prev(); }if (this.Parent!=null){return this.Parent; }return null; } ; RadTreeNode.prototype.Toggle= function (){if (this.Enabled){if (this.TreeView.FireEvent(this.TreeView.BeforeClientToggle,this )== false){return; } (this.Expanded)?this.Collapse(): this.Expand(); this.TreeView.FireEvent(this.TreeView.AfterClientToggle,this ); }} ; RadTreeNode.prototype.CollapseNonParentNodes= function (){for (var i=0; i<this.TreeView.AllNodes.length; i++){if (this.TreeView.AllNodes[i].Expanded && !this.IsParent(this.TreeView.AllNodes[i])){ this.TreeView.AllNodes[i].CollapseNoEffect(); }}} ; RadTreeNode.prototype.U= function (s){try {return encodeURIComponent(s); }catch (e){return escape(s); }} ; RadTreeNode.prototype.Z= function (){var url=this.TreeView.LoadOnDemandUrl+"\x26\x72tnClien\x74\x49D="+this.ClientID+"\x26rtnLev\x65\x6c="+this.Level+"\x26rtnID\x3d"+this.ID+"\x26rtnPa\x72\x65ntPo\x73\x69tio\x6e="+this.GetParentPositions()+"&rtnText\x3d"+this.U(this.Text)+"\046\x72tnValue="+this.U(this.Value)+"&rtnCatego\x72\x79="+this.U(this.Category)+"\x26\x72tnChec\x6b\x65d="+this.Checked; var z; if (typeof(XMLHttpRequest)!="\x75ndefined"){z=new XMLHttpRequest(); }else {z=new ActiveXObject("Micros\x6f\x66t.XM\x4c\x48TTP"); }url=url+"\x26timeStam\x70\x3d"+encodeURIComponent((new Date()).getTime()); z.open("\x47ET",url, true); var W=this ; z.onreadystatechange= function (){if (z.readyState!=4)return; var html=z.responseText; var index=html.indexOf("\x2c"); var V=parseInt(html.substring(0,index)); var v=html.substring(index+1,V+index+1); var T=html.substring(V+index+1); W.LoadNodesOnDemand(v); W.ImageOn(); W.SignOn(); W.Expanded= true; W.ExpandOnServer=0; var S=W.TextElement().parentNode; var R=S.parentNode; switch (W.TreeView.LoadingMessagePosition){case 0:case 1:if (S.tagName=="A"){S.firstChild.innerHTML=W.Text; }else {R=W.TextElement().parentNode; if (W.TextElement().innerText){W.TextElement().innerText=W.Text; }else {W.TextElement().innerHTML=W.Text; }}break; case 2:S.removeChild(document.getElementById(W.ClientID+"\x4coa\x64\x69ng")); R=W.TextElement().parentNode; break; case 3:R=W.TextElement().parentNode; }if (W.Nodes.length>0){rtvInsertHTML(R,T); var images=R.getElementsByTagName("IMG"); for (var i=0; i<images.length; i++){images[i].style.display="\x69\x6eline"; images[i].style.verticalAlign="m\x69\x64dle"; }var Q=R.getElementsByTagName("\x49NPUT"); for (var i=0; i<Q.length; i++){Q[i].style.verticalAlign="middle"; }}W.O= false; W.TreeView.FireEvent(W.TreeView.AfterClientToggle,W); } ; z.send(null); } ; RadTreeNode.prototype.Expand= function (){if (this.ExpandOnServer){if (!this.TreeView.FireEvent(this.TreeView.BeforeClientToggle,this )){return; }if (this.ExpandOnServer==1){ this.TreeView.P("Nod\x65Expand",this.ClientID); return; }if (this.ExpandOnServer==2){if (!this.O){ this.O= true; switch (this.TreeView.LoadingMessagePosition){case 0: this.TextElement().innerHTML="\x3cspan cl\x61\x73s="+this.TreeView.LoadingMessageCssClass+">"+this.TreeView.LoadingMessage+"</span> "+this.TextElement().innerHTML; break; case 1: this.TextElement().innerHTML=this.TextElement().innerHTML+" "+"<span cl\x61\x73s="+this.TreeView.LoadingMessageCssClass+"\x3e"+this.TreeView.LoadingMessage+"\x3c/span\x3e\x20"; break; case 2:rtvInsertHTML(this.TextElement().parentNode,"\x3cdiv \x69\x64="+this.ClientID+"\x4c\x6fading "+" cl\x61\x73s="+this.TreeView.LoadingMessageCssClass+">"+this.TreeView.LoadingMessage+"\x3c\x2fdiv>"); break; }var W=this ; window.setTimeout( function (){W.Z();} ,20); return; }}}if (!this.Nodes.length){return; }if (this.TreeView.SingleExpandPath){ this.CollapseNonParentNodes(); }var N=document.getElementById("\x47"+this.ClientID); if (this.TreeView.ExpandDelay>0){N.style.overflow="\x68idden"; N.style.height="1px"; N.style.display="b\x6c\x6fck"; N.firstChild.style.position="\x72\x65lative"; window.setTimeout("rtvNo\x64\x65Expan\x64\x281,\x27"+N.id+"\047\054"+this.TreeView.ExpandDelay+");",20); }else {N.style.display="block"; } this.ImageOn(); this.SignOn(); this.Expanded= true; if (!this.IsClientNode){ this.TreeView.UpdateExpandedState(); }} ; RadTreeNode.prototype.GetParentPositions= function (){var parentNode=this ; var M=""; while (parentNode!=null){if (parentNode.Next()!=null){M=M+"1"; }else {M=M+"0"; }parentNode=parentNode.Parent; }return M; } ; RadTreeNode.prototype.Collapse= function (){if (this.Nodes.length>0){if (this.TreeView.ExpandDelay>0){var N=document.getElementById("\x47"+this.ClientID); if (N.scrollHeight!="unde\x66\x69ned"){N.style.overflow="hidd\x65\x6e"; N.style.display="\x62lock"; N.firstChild.style.position="\x72elative"; window.setTimeout("rtvNodeColl\x61\x70se("+N.scrollHeight+",\047"+N.id+"\x27,"+this.TreeView.ExpandDelay+" );",20); }else { this.CollapseNoEffect(); }}else { this.CollapseNoEffect(); } this.ImageOff(); this.SignOff(); this.Expanded= false; this.TreeView.UpdateExpandedState(); }} ; RadTreeNode.prototype.CollapseNoEffect= function (){if (this.Nodes.length>0){var N=document.getElementById("\x47"+this.ClientID); N.style.display="\x6eone"; this.ImageOff(); this.SignOff(); this.Expanded= false; this.TreeView.UpdateExpandedState(); }} ; RadTreeNode.prototype.Highlight= function (e){if (!this.Enabled){return; }if (e){if (this.TreeView.MultipleSelect && (e.ctrlKey || e.shiftKey)){if (this.Selected){ this.TextElement().className=this.NodeCss; this.Selected= false; if (this.TreeView.SelectedNode==this ){ this.TreeView.SelectedNode=null; } this.TreeView.UpdateSelectedState(); return; }}else { this.TreeView.UnSelectAllNodes(); }} this.TextElement().className=this.NodeCssSelect; this.TreeView.SelectNode(this ); this.TreeView.FireEvent(this.TreeView.AfterClientHighlight,this ); } ; RadTreeNode.prototype.ExecuteAction= function (e){if (this.IsClientNode){return; }if (this.TextElement().tagName=="\101"){ this.TextElement().click(); }else if (this.Action){ this.TreeView.P("N\x6f\x64\x65Clic\x6b",this.ClientID); }if (e){ (document.all)?e.returnValue= false :e.preventDefault(); }} ; RadTreeNode.prototype.Select= function (e){if (this.TreeView.FireEvent(this.TreeView.BeforeClientClick,this,e)== false)return; if (this.Enabled){ this.Highlight(e); this.TreeView.LastHighlighted=this ; this.ExecuteAction(); }else { (document.all)?e.returnValue= false :e.preventDefault(); } this.TreeView.FireEvent(this.TreeView.AfterClientClick,this,e); } ; RadTreeNode.prototype.UnSelect= function (){if (this.TextElement().parentNode && this.TextElement().parentNode.tagName=="A"){ this.TextElement().parentNode.className=this.NodeCss; } this.TextElement().className=this.NodeCss; this.Selected= false; } ; RadTreeNode.prototype.Disable= function (){ this.TextElement().className=this.TreeView.NodeCssDisable; this.Enabled= false; this.Selected= false; if (this.CheckElement()!=null)this.CheckElement().disabled= true; } ; RadTreeNode.prototype.Enable= function (){ this.TextElement().className=this.NodeCss; this.Enabled= true; if (this.CheckElement()!=null){ this.CheckElement().disabled= false; }} ; RadTreeNode.prototype.Hover= function (){if (this.Enabled){if (this.TreeView.FireEvent(this.TreeView.BeforeClientHighlight,this )== false){return; } this.TreeView.LastHighlighted=this ; if (RadTreeView_DragActive!=null && RadTreeView_DragActive.DragClone!=null && (!this.Expanded) && this.ExpandOnServer!=1){var W=this ; window.setTimeout( function (){W.m(); } ,1000); }if (!this.Selected){ this.TextElement().className=this.NodeCssOver; if (this.Image){ this.L().style.cursor="hand"; }} this.TreeView.FireEvent(this.TreeView.AfterClientHighlight,this ); }} ; RadTreeNode.prototype.m= function (){if (RadTreeView_DragActive!=null && RadTreeView_DragActive.DragClone!=null && (!this.Expanded)){if (RadTreeView_Active.LastHighlighted==this ){ this.Expand(); }}} ; RadTreeNode.prototype.UnHover= function (){if (this.Enabled){ this.TreeView.LastHighlighted=null; if (!this.Selected){ this.TextElement().className=this.NodeCss; if (this.Image){ this.L().style.cursor="defa\x75l\x74"; }}}} ; RadTreeNode.prototype.CheckBoxClick= function (e){if (this.Enabled){if (this.TreeView.FireEvent(this.TreeView.BeforeClientCheck,this )== false){ (this.Checked)?this.Check(): this.UnCheck(); return; } (this.Checked)?this.UnCheck(): this.Check(); this.TreeView.FireEvent(this.TreeView.AfterClientCheck,this ); if (this.TreeView.AutoPostBackOnCheck){ this.TreeView.P("N\x6fdeCheck",this.ClientID); return; }}} ; RadTreeNode.prototype.Check= function (){if (this.CheckElement()!=null){ this.CheckElement().checked= true; this.Checked= true; this.TreeView.UpdateCheckedState(); }} ; RadTreeNode.prototype.UnCheck= function (){if (this.CheckElement()!=null){ this.CheckElement().checked= false; this.Checked= false; this.TreeView.UpdateCheckedState(); }} ; RadTreeNode.prototype.IsSet= function (a){return (a!=null && a!=""); } ; RadTreeNode.prototype.ImageOn= function (){var l=document.getElementById(this.ClientID+"\x69"); if (this.ImageExpanded!=0){l.src=this.ImageExpanded; }} ; RadTreeNode.prototype.ImageOff= function (){var l=document.getElementById(this.ClientID+"i"); if (this.Image!=0){l.src=this.Image; }} ; RadTreeNode.prototype.SignOn= function (){var K=document.getElementById(this.ClientID+"\x63"); if (this.IsSet(this.SignImageExpanded)){K.src=this.SignImageExpanded; }} ; RadTreeNode.prototype.SignOff= function (){var K=document.getElementById(this.ClientID+"\x63"); if (this.IsSet(this.SignImage)){K.src=this.SignImage; }} ; RadTreeNode.prototype.TextElement= function (){var k=document.getElementById(this.ClientID); var J=k.getElementsByTagName("sp\x61\x6e")[0]; if (J==null){J=k.getElementsByTagName("\x61")[0]; }return J; } ; RadTreeNode.prototype.L= function (){return document.getElementById(this.ClientID+"i"); } ; RadTreeNode.prototype.CheckElement= function (){return document.getElementById(this.ClientID).getElementsByTagName("input")[0]; } ; RadTreeNode.prototype.IsParent= function (node){var parent=this.Parent; while (parent!=null){if (node==parent)return true; parent=parent.Parent; }return false; } ; RadTreeNode.prototype.StartEdit= function (){if (this.EditEnabled){var H=this.Text; this.TreeView.EditMode= true; var parentElement=this.TextElement().parentNode; this.TreeView.EditTextElement=this.TextElement().cloneNode( true); this.TextElement().parentNode.removeChild(this.TextElement()); var h=this ; var g=document.createElement("input"); g.setAttribute("type","\x74e\x78\x74"); g.setAttribute("\x73\x69ze",this.Text.length+3); g.setAttribute("value",H); g.className=this.TreeView.NodeCssEdit; var F=this ; g.onblur= function (){F.EndEdit(); } ; g.onchange= function (){F.EndEdit(); } ; g.onkeypress= function (e){F.AnalyzeEditKeypress(e); } ; g.onsubmit= function (){return false; } ; parentElement.appendChild(g); this.TreeView.EditInputElement=g; g.focus(); g.onselectstart= function (e){if (!e)e=window.event; if (e.stopPropagation){e.stopPropagation(); }else {e.cancelBubble= true; }} ; var f=0; var D=this.Text.length; if (g.createTextRange){var d=g.createTextRange(); d.moveStart("c\x68aracter",f); d.moveEnd("character",D); d.select(); }else {g.setSelectionRange(f,D); }}} ; RadTreeNode.prototype.EndEdit= function (){ this.TreeView.EditInputElement.onblur=null; this.TreeView.EditInputElement.onchange=null; var parentElement=this.TreeView.EditInputElement.parentNode; if (this.TreeView.FireEvent(this.TreeView.AfterClientEdit,this,this.Text,this.TreeView.EditInputElement.value)!= false){if (this.Text!=this.TreeView.EditInputElement.value){var C=this.ClientID+"\x3a"+this.TreeView.B(this.TreeView.EditInputElement.value); this.TreeView.P("No\x64\x65Edit",C); return; } this.TreeView.EditTextElement.innerHTML=this.TreeView.EditInputElement.value; this.Text=this.TreeView.EditInputElement.value; } this.TreeView.EditInputElement.parentNode.removeChild(this.TreeView.EditInputElement); parentElement.appendChild(this.TreeView.EditTextElement); this.TreeView.EditMode= false; this.TreeView.EditInputElement=null; this.TreeView.EditTextElement=null; } ; RadTreeNode.prototype.AnalyzeEditKeypress= function (e){if (document.all)e=event; if (e.keyCode==13){ (document.all)?e.returnValue= false :e.preventDefault(); this.EndEdit(); return false; }if (e.keyCode==27){ this.TreeView.EditInputElement.value=this.TreeView.EditTextElement.innerHTML; this.EndEdit(); }return true; } ; RadTreeNode.prototype.LoadNodesOnDemand= function (s){eval(s); var o0=eval(this.ClientID+"\x43lientDat\x61"); for (var i=0; i<o0.length; i++){o0[i][17]=0; this.TreeView.LoadNode(o0[i],null,this ); }} ; function RadTreeView(O0){if (window.tlrkTreeViews==null){window.tlrkTreeViews=new Array(); }tlrkTreeViews[O0]=this ; this.Nodes=new Array(); this.AllNodes=new Array(); this.ClientID=null; this.SelectedNode=null; this.DragMode= false; this.DragSource=null; this.DragClone=null; this.LastHighlighted=null; this.MouseInside= false; this.HtmlElementID=""; this.EditMode= false; this.EditTextElement=null; this.EditInputElement=null; this.BeforeClientClick=null; this.BeforeClientHighlight=null; this.AfterClientHighlight=null; this.BeforeClientDrop=null; this.BeforeClientToggle=null; this.AfterClientToggle=null; this.BeforeClientContextClick=null; this.BeforeClientContextMenu=null; this.AfterClientContextClick=null; this.BeforeClientCheck=null; this.AfterClientCheck=null; this.AfterClientMove=null; this.AfterClientFocus=null; this.BeforeClientDrag=null; this.AfterClientEdit=null; this.AfterClientClick=null; this.AutoPostBackOnCheck= false; this.CausesValidation= true; this.ContextMenuVisible= false; this.ContextMenuName=null; this.l0=null; this.SingleExpandPath= false; this.ExpandDelay=2; this.TabIndex=0; this.AllowNodeEditing= false; this.LoadOnDemandUrl=null; this.LoadingMessage="(loading\x20...)"; this.LoadingMessagePosition=0; this.LoadingMessageCssClass="Lo\x61\x64ingMess\x61\147\x65"; this.i0= false; this.I0(document.getElementById(this.Container)); } ; RadTreeView.prototype.OnInit= function (){var ImageList=new Array(); this.PreloadImages(ImageList); o1=ImageList; var images=document.getElementById(this.Container).getElementsByTagName("\x49MG"); for (var i=0; i<images.length; i++){var index=images[i].className; if (index!=null && index!=""){images[i].src=ImageList[index].src; }images[i].style.display="inli\x6e\x65"; images[i].style.verticalAlign="\x6d\x69ddle"; } this.LoadTree(ImageList); var Q=document.getElementById(this.Container).getElementsByTagName("\x49NPUT"); for (var i=0; i<Q.length; i++){Q[i].style.verticalAlign="\x6diddle"; }if (document.addEventListener && (!RadTreeView_KeyboardHooked)){RadTreeView_KeyboardHooked= true; document.addEventListener("\x6b\145\x79\x64own",this.KeyDownMozilla, false); }if ((!RadTreeView_MouseMoveHooked) && (this.DragAndDrop)){RadTreeView_MouseMoveHooked= true; if (document.attachEvent){document.attachEvent("onmousemov\x65",rtvMouseMove); }if (document.addEventListener){document.addEventListener("\x6d\x6fusemo\x76\x65",rtvMouseMove, false); }}if (!RadTreeView_MouseUpHooked){RadTreeView_MouseUpHooked= true; if (document.attachEvent){document.attachEvent("onmouseup",rtvMouseUp); }if (document.addEventListener){document.addEventListener("mouse\x75\x70",rtvMouseUp, false); }} this.O1(); this.i0= true; } ; RadTreeView.prototype.O1= function (){var h=this ; var l1=document.getElementById(this.Container); l1.onfocus= function (e){rtvDispatcher(h.ClientID,"\x66ocus",e); } ; l1.onmouseover= function (e){rtvDispatcher(h.ClientID,"mov\x65\x72",e); } ; l1.onmouseout= function (e){rtvDispatcher(h.ClientID,"\x6dout",e); } ; l1.oncontextmenu= function (e){rtvDispatcher(h.ClientID,"context",e); } ; l1.onscroll= function (e){rtvDispatcher(h.ClientID,"\x73\x63roll",e); } ; l1.onclick= function (e){rtvDispatcher(h.ClientID,"\x6d\143li\x63\x6b",e); } ; l1.ondblclick= function (e){rtvDispatcher(h.ClientID,"m\x64\x63lick",e); } ; l1.onkeydown= function (e){rtvDispatcher(h.ClientID,"\x6beydown",e); } ; l1.onselectstart= function (){return false; } ; l1.ondragstart= function (){return false; } ; if (this.DragAndDrop){l1.onmousedown= function (e){rtvDispatcher(h.ClientID,"\x6d\x64own",e); } ; }if (window.attachEvent){window.attachEvent("onunloa\x64", function (){var l1=document.getElementById(h.Container); h.I0(l1); } ); }} ; RadTreeView.prototype.I0= function (l1){for (var i1 in l1){if (typeof(l1[i1])=="\x66unction"){l1[i1]=null; }}};RadTreeView.prototype.PreloadImages= function (images){var imageData=eval(this.ClientID+"ImageData"); for (var i=0; i<imageData.length; i++){var I1=new Image(); I1.src=imageData[i]; images[i]=I1; }} ; RadTreeView.prototype.FindNode= function (node){for (var i=0; i<this.AllNodes.length; i++){if (this.AllNodes[i].ClientID==node){return this.AllNodes[i]; }}return null; } ; RadTreeView.prototype.FindNodeByText= function (text){for (var i=0; i<this.AllNodes.length; i++){if (this.AllNodes[i].Text==text){return this.AllNodes[i]; }}return null; } ; RadTreeView.prototype.FindNodeByValue= function (value){for (var i=0; i<this.AllNodes.length; i++){if (this.AllNodes[i].Value==value){return this.AllNodes[i]; }}return null; } ; RadTreeView.prototype.LoadTree= function (o2){var O2=eval(this.ClientID+"C\x6cientDa\x74\x61"); for (var i=0; i<O2.length; i++){ this.LoadNode(O2[i],o2); }} ; RadTreeView.prototype.LoadNode= function (O2,o2,parentNode){var l2=new RadTreeNode(); l2.ClientID=O2[0]; l2.TreeView=this ; var i2=O2[17]; if (i2>0){l2.Parent=this.AllNodes[i2-1]; }if (parentNode!=null){l2.Parent=parentNode; }l2.NodeCss=this.NodeCss; l2.NodeCssOver=this.NodeCssOver; l2.NodeCssSelect=this.NodeCssSelect; l2.Text=O2[1]; l2.Value=O2[2]; l2.Category=O2[3]; if (o2!=null){l2.SignImage=o2[O2[4]].src; l2.SignImageExpanded=o2[O2[5]].src; }else {l2.SignImage=o1[O2[4]].src; l2.SignImageExpanded=o1[O2[5]].src; }if (O2[6]>0){l2.Image=o2[O2[6]].src; }if (O2[7]>0){l2.ImageExpanded=o2[O2[7]].src; }l2.Selected=O2[8]; if (l2.Selected){ this.SelectedNode=l2; }l2.Checked=O2[9]; l2.Enabled=O2[10]; l2.Expanded=O2[11]; l2.Action=O2[12]; if (this.IsSet(O2[13]))l2.NodeCss=O2[13]; if (this.IsSet(O2[14]))l2.ContextMenuName=O2[14]; this.AllNodes[this.AllNodes.length]=l2; if (l2.Parent!=null){l2.Parent.Nodes[l2.Parent.Nodes.length]=l2; }else { this.Nodes[this.Nodes.length]=l2; }l2.Index=O2[16]; l2.DragEnabled=O2[18]; l2.DropEnabled=O2[19]; l2.ExpandOnServer=O2[20]; if (this.IsSet(O2[21]))l2.NodeCssOver=O2[21]; if (this.IsSet(O2[22]))l2.NodeCssSelect=O2[22]; l2.Level=O2[23]; l2.ID=O2[24]; l2.IsClientNode=O2[25]; l2.EditEnabled=O2[26]; l2.Attributes=O2[27]; } ; RadTreeView.prototype.Toggle= function (node){ this.FindNode(node).Toggle(); } ; RadTreeView.prototype.Select= function (node,e){ this.FindNode(node).Select(e); } ; RadTreeView.prototype.Hover= function (node){var node=this.FindNode(node); if (node)node.Hover(); } ; RadTreeView.prototype.UnHover= function (node){var node=this.FindNode(node); if (node)node.UnHover(); } ; RadTreeView.prototype.CheckBoxClick= function (node,e){ this.FindNode(node).CheckBoxClick(e); } ; RadTreeView.prototype.Highlight= function (node,e){ this.FindNode(node).Highlight(e); } ; RadTreeView.prototype.SelectNode= function (node){ this.SelectedNode=node; node.Selected= true; this.UpdateSelectedState(); } ; RadTreeView.prototype.GetSelectedNodes= function (){var I2=new Array(); for (var i=0; i<this.AllNodes.length; i++){if (this.AllNodes[i].Selected)I2[I2.length]=this.AllNodes[i]; }return I2; } ; RadTreeView.prototype.UnSelectAllNodes= function (node){for (var i=0; i<this.AllNodes.length; i++){if (this.AllNodes[i].Selected && this.AllNodes[i].Enabled){ this.AllNodes[i].UnSelect(); }}} ; RadTreeView.prototype.KeyDownMozilla= function (e){var LastActiveRadTreeView=RadTreeView_Active; if (LastActiveRadTreeView){if (!LastActiveRadTreeView.i0)return; if (LastActiveRadTreeView!=null && LastActiveRadTreeView.SelectedNode!=null){if (LastActiveRadTreeView.EditMode)return; if (e.keyCode==107 || e.keyCode==109 || e.keyCode==37 || e.keyCode==39)LastActiveRadTreeView.SelectedNode.Toggle(); if (e.keyCode==40 && LastActiveRadTreeView.SelectedNode.NextVisible()!=null)LastActiveRadTreeView.SelectedNode.NextVisible().Highlight(e); if (e.keyCode==38 && LastActiveRadTreeView.SelectedNode.PrevVisible()!=null)LastActiveRadTreeView.SelectedNode.PrevVisible().Highlight(e); if (e.keyCode==13){if (LastActiveRadTreeView.FireEvent(LastActiveRadTreeView.BeforeClientClick,LastActiveRadTreeView.SelectedNode,e)== false){return; }LastActiveRadTreeView.SelectedNode.ExecuteAction(); }if (e.keyCode==32)LastActiveRadTreeView.SelectedNode.CheckBoxClick(); if (e.keyCode==113 && LastActiveRadTreeView.AllowNodeEditing)LastActiveRadTreeView.SelectedNode.StartEdit(); }}} ; RadTreeView.prototype.KeyDown= function (e){if (this.EditMode)return; var node=this.SelectedNode; if (node!=null){if (e.keyCode==107 || e.keyCode==109 || e.keyCode==37 || e.keyCode==39)node.Toggle(); if (e.keyCode==40 && node.NextVisible()!=null)node.NextVisible().Highlight(e); if (e.keyCode==38 && node.PrevVisible()!=null)node.PrevVisible().Highlight(e); if (e.keyCode==13){if (this.FireEvent(this.BeforeClientClick,this.SelectedNode,e)== false){return; }node.ExecuteAction(e); }if (e.keyCode==32){node.CheckBoxClick(); (document.all)?e.returnValue= false :e.preventDefault(); }if (e.keyCode==113 && this.AllowNodeEditing){node.StartEdit(); }}else {if (e.keyCode==38 || e.keyCode==40 || e.keyCode==13 || e.keyCode==32){ this.Nodes[0].Highlight(); }}} ; RadTreeView.prototype.UpdateState= function (){ this.UpdateExpandedState(); this.UpdateCheckedState(); this.UpdateSelectedState(); } ; RadTreeView.prototype.UpdateExpandedState= function (){var o3=""; for (var i=0; i<this.AllNodes.length; i++){var O3=(this.AllNodes[i].Expanded)?"\061": "0"; o3+=O3; }document.getElementById(this.ClientID+"\x5fexp\x61\x6eded").value=o3; } ; RadTreeView.prototype.UpdateCheckedState= function (){var l3=""; for (var i=0; i<this.AllNodes.length; i++){var i3=(this.AllNodes[i].Checked)?"1": "0"; l3+=i3; }document.getElementById(this.ClientID+"_checked").value=l3; } ; RadTreeView.prototype.UpdateSelectedState= function (){var I3=""; for (var i=0; i<this.AllNodes.length; i++){var o4=(this.AllNodes[i].Selected)?"\x31": "0"; I3+=o4; }document.getElementById(this.ClientID+"_s\x65\x6cected").value=I3; } ; RadTreeView.prototype.Scroll= function (e){document.getElementById(this.ClientID+"_\x73\x63roll").value=document.getElementById(this.Container).scrollTop; } ; RadTreeView.prototype.ContextMenuClick= function (e,O4,l4,i4){h=this ; window.setTimeout( function (){h.HideContextMenu();} ,10); if (this.FireEvent(this.BeforeClientContextClick,this.l0,O4,i4)== false){return; }if (l4){var I4=this.l0.ClientID+":"+this.B(O4)+":"+this.B(i4); this.P("\x43ontextMe\x6euClick",I4); }} ; RadTreeView.prototype.ContextMenu= function (e,o5){var src=(e.srcElement)?e.srcElement:e.target; var node=this.FindNode(o5); if (node!=null && this.BeforeClientContextMenu!=null){var O5=this.SelectedNode; if (this.FireEvent(this.BeforeClientContextMenu,node,e,O5)== false){return; } this.Highlight(o5,e,O5); }if (node!=null && node.ContextMenuName!=null && node.Enabled){if (!this.ContextMenuVisible){ this.l0=node; if (!node.Selected){ this.Highlight(o5,e); } this.ShowContextMenu(node.ContextMenuName,e); document.all?e.returnValue= false :e.preventDefault(); }}} ; RadTreeView.prototype.ShowContextMenu= function (name,e){if (!document.readyState || document.readyState=="complet\x65"){var l5="rtvcm"+this.ClientID+name; var menu=document.getElementById(l5); if (menu){var i5=menu.cloneNode( true); i5.id=l5+"\x5fclone"; document.body.appendChild(i5); i5=document.getElementById(l5+"_clon\x65"); i5.style.left=this.I5(e)+"px"; i5.style.top=this.o6(e)+"\x70x"; i5.style.position="\x61\142\x73\x6flut\x65"; i5.style.display="\x62lock"; this.ContextMenuVisible= true; this.ContextMenuName=name; document.all?e.returnValue= false :e.preventDefault(); }}} ; RadTreeView.prototype.o6= function (e){if (document.compatMode && document.compatMode=="CS\x53\x31Compat"){return (e.clientY+document.documentElement.scrollTop); }return (e.clientY+document.body.scrollTop); } ; RadTreeView.prototype.I5= function (e){if (document.compatMode && document.compatMode=="CSS1Compat"){return (e.clientX+document.documentElement.scrollLeft); }return (e.clientX+document.body.scrollLeft); } ; RadTreeView.prototype.HideContextMenu= function (){if (!document.readyState || document.readyState=="\x63omplete"){var O6=document.getElementById("rtvcm"+this.ClientID+this.ContextMenuName+"\x5fclon\x65"); if (O6){document.body.removeChild(O6); } this.ContextMenuVisible= false; }} ; RadTreeView.prototype.MouseClickDispatcher= function (e){var src=(e.srcElement)?e.srcElement:e.target; var o5=rtvGetNodeID(e); if (o5!=null){var l6=this.FindNode(o5); if (l6.Selected){if (this.AllowNodeEditing){l6.StartEdit(); return; }else { this.Select(o5,e); }}else { this.Select(o5,e); }}if (src.tagName=="I\x4dG"){var i6=src.className; if (this.IsSet(i6) && this.I6(i6)){ this.Toggle(src.parentNode.id); }}if (src.tagName=="INPUT" && rtvInsideNode(src)){ this.CheckBoxClick(src.parentNode.id,e); }} ; RadTreeView.prototype.I6= function (o7){return (o7==1 || o7==2 || o7==5 || o7==6 || o7==7 || o7==8 || o7==10 || o7==11); } ; RadTreeView.prototype.DoubleClickDispatcher= function (e,o5){ this.Toggle(o5); } ; RadTreeView.prototype.MouseOverDispatcher= function (e,o5){ this.Hover(o5); } ; RadTreeView.prototype.MouseOutDispatcher= function (e,o5){ this.UnHover(o5); } ; RadTreeView.prototype.MouseDown= function (e){if (this.LastHighlighted!=null && this.DragAndDrop){if (this.FireEvent(this.BeforeClientDrag,this.LastHighlighted)== false)return; if (!this.LastHighlighted.DragEnabled)return; if (e.button==2)return; this.DragSource=this.LastHighlighted; this.DragClone=document.createElement("\144\x69v"); document.body.appendChild(this.DragClone); RadTreeView_DragActive=this ; var O7=""; if (this.MultipleSelect && (this.SelectedNodesCount()>1)){for (var i=0; i<this.AllNodes.length; i++){if (this.AllNodes[i].Selected){if (this.AllNodes[i].Image){var img=this.AllNodes[i].L(); var l7=img.cloneNode( true); this.DragClone.appendChild(l7); }var i7=this.AllNodes[i].TextElement().cloneNode( true); i7.className=this.AllNodes[i].NodeCss; i7.style.color="\x67ray"; this.DragClone.appendChild(i7); this.DragClone.appendChild(document.createElement("\x42R")); }O7=O7+"text"; }}if (O7==""){if (this.LastHighlighted.Image){var img=this.LastHighlighted.L(); var l7=img.cloneNode( true); this.DragClone.appendChild(l7); }var i7=this.LastHighlighted.TextElement().cloneNode( true); i7.className=this.LastHighlighted.NodeCss; i7.style.color="g\x72\x61y"; this.DragClone.appendChild(i7); } this.DragClone.style.position="absolute"; this.DragClone.style.display="n\x6f\x6ee"; if (e.preventDefault){e.preventDefault(); }}} ; RadTreeView.prototype.SelectedNodesCount= function (){var count=0; for (var i=0; i<this.AllNodes.length; i++){if (this.AllNodes[i].Selected)count++; }return count; } ; RadTreeView.prototype.FireEvent= function (I7,a,b,o8){if (!I7){return true; }RadTreeViewGlobalFirstParam=a; RadTreeViewGlobalSecondParam=b; RadTreeViewGlobalThirdParam=o8; var s=I7+"\050\x52adTree\x56\151ew\x47\x6co\x62\x61lFi\x72\x73tP\x61\x72am\x2c Ra\x64\124r\x65eView\x47\154o\x62alSec\x6fndPar\x61m, Ra\x64Tr\x65eVie\x77Glob\x61lThi\x72dPar\x61m);"; return eval(s); } ; RadTreeView.prototype.Focus= function (e){ this.FireEvent(this.AfterClientFocus,this ); } ; RadTreeView.prototype.IsSet= function (a){return (a!=null && a!=""); } ; RadTreeView.prototype.O8= function (l8){var i8=0; if (l8.offsetParent){while (l8.offsetParent){i8+=l8.offsetLeft; l8=l8.offsetParent; }}else if (l8.x)i8+=l8.x; return i8; } ; RadTreeView.prototype.I8= function (l8){var o9=0; if (l8.offsetParent){while (l8.offsetParent){o9+=l8.offsetTop; l8=l8.offsetParent; }}else if (l8.y)o9+=l8.y; return o9; } ; RadTreeView.prototype.P= function (O9,C){var l9=O9+"#"+C; if (this.PostBackOptionsClientString){var i9=this.PostBackOptionsClientString.replace(/\x40\x40\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\x40\x40/g,l9); if (typeof(WebForm_PostBackOptions)!="undefine\x64" || i9.indexOf("_doPo\x73\x74Back")>-1 || i9.indexOf("\x41syncReque\x73\x74")>-1){eval(i9); }}else {if (this.CausesValidation){if (!(typeof(Page_ClientValidate)!="fun\x63\x74ion" || Page_ClientValidate())){return; }}var I9=this.PostBackFunction.replace(/\x40\x40\x61\x72\x67\x75\x6d\x65\x6e\x74\x73\x40\x40/g,l9); eval(I9); }} ; RadTreeView.prototype.B= function (param){var oa=param.replace(/\x27/g,"\x26squote"); oa=oa.replace(/\x23/g,"\x26ssharp"); oa=oa.replace(/\x3a/g,"&scolon"); oa=oa.replace(/\x5c/g,"\x5c\134"); return oa; } ; function rtvIsAnyContextMenuVisible(){for (var key in tlrkTreeViews)if ((typeof(tlrkTreeViews[key])!="funct\x69\x6fn") && tlrkTreeViews[key].ContextMenuVisible)return true; return false; } ; function rtvAdjustScroll(){if (RadTreeView_DragActive==null || RadTreeView_DragActive.DragClone==null){return; }var Oa=RadTreeView_Active; var la=document.getElementById(RadTreeView_Active.Container); var ia,Ia; ia=Oa.I8(la); Ia=ia+la.offsetHeight; if ((RadTreeView_MouseY-ia)<50 && la.scrollTop>0){la.scrollTop=la.scrollTop-10; Oa.Scroll(); RadTreeView_ScrollTimeout=window.setTimeout( function (){rtvAdjustScroll(); } ,100); }else if ((Ia-RadTreeView_MouseY)<50 && la.scrollTop<(la.scrollHeight-la.offsetHeight+16)){la.scrollTop=la.scrollTop+10; Oa.Scroll(); RadTreeView_ScrollTimeout=window.setTimeout( function (){rtvAdjustScroll(); } ,100); }} ; function rtvMouseUp(e){if (RadTreeView_Active==null)return; if (e && !e.ctrlKey){for (var key in tlrkTreeViews){if ((typeof(tlrkTreeViews[key])!="functi\x6fn") && tlrkTreeViews[key].ContextMenuVisible){contextMenuToBeHidden=tlrkTreeViews[key]; window.setTimeout("contextMen\x75\x54oBe\x48\x69dde\x6e.HideC\x6f\x6etex\x74Menu()",10); return; }}}if (RadTreeView_DragActive==null || RadTreeView_DragActive.DragClone==null){return; } (document.all)?e.returnValue= false :e.preventDefault(); var ob=RadTreeView_DragActive.DragSource; var Ob=RadTreeView_Active.LastHighlighted; var lb=RadTreeView_Active; document.body.removeChild(RadTreeView_DragActive.DragClone); RadTreeView_DragActive.DragClone=null; if (Ob!=null && Ob.DropEnabled== false)return; if (ob==Ob)return; if (RadTreeView_DragActive.FireEvent(RadTreeView_DragActive.BeforeClientDrop,ob,Ob,e)== false)return; if (ob.IsClientNode || ((Ob!=null) && Ob.IsClientNode))return; var ib=RadTreeView_DragActive.ClientID+"\043"+ob.ClientID+"\x23"; var Ib=""; if (Ob==null){Ib="null"+"\x23"+RadTreeView_DragActive.HtmlElementID; }else {Ib=lb.ClientID+"\x23"+Ob.ClientID; }if (Ob==null && RadTreeView_DragActive.HtmlElementID==""){return; }RadTreeView_DragActive.P("NodeDr\x6f\x70",ib+Ib); RadTreeView_DragActive=null; } ; function rtvMouseMove(e){if (rtvIsAnyContextMenuVisible()){return; }if (RadTreeView_DragActive!=null && RadTreeView_DragActive.DragClone!=null){var oc,Oc; oc=RadTreeView_DragActive.I5(e)+8; Oc=RadTreeView_DragActive.o6(e)+4; RadTreeView_MouseY=Oc; rtvAdjustScroll(); RadTreeView_DragActive.DragClone.style.zIndex=999; RadTreeView_DragActive.DragClone.style.top=Oc+"px"; RadTreeView_DragActive.DragClone.style.left=oc+"\x70x"; RadTreeView_DragActive.DragClone.style.display="blo\x63k"; RadTreeView_DragActive.FireEvent(RadTreeView_DragActive.AfterClientMove,e); (document.all)?e.returnValue= false :e.preventDefault(); }} ; function rtvNodeExpand(a,id,lc){var ic=document.getElementById(id); var Ic=ic.scrollHeight; var od=(Ic-a)/lc; var height=a+od; if (height>Ic-1){ic.style.height=""; ic.firstChild.style.position=""; }else {ic.style.height=height+"\x70x"; window.setTimeout("\x72\164\x76\x4eodeE\x78\x70and\x28"+height+","+"\x27"+id+"\x27\x2c"+lc+");",5); }} ; function rtvNodeCollapse(a,id,lc){var ic=document.getElementById(id); var Ic=ic.scrollHeight; var od=(Ic-Math.abs(Ic-a))/lc; var height=a-od; if (height<=3){ic.style.height=""; ic.style.display="none"; ic.firstChild.style.position=""; }else {ic.style.height=height+"p\x78"; window.setTimeout("rtvNodeC\x6f\x6cla\x70\x73e("+height+"\054"+"\x27"+id+"\047\x2c"+lc+"\x20\x29;",5); }} ; function rtvGetNodeID(e){if (RadTreeView_Active==null)return; var target=(e.srcElement)?e.srcElement:e.target; if (target.tagName=="IMG" && target.nextSibling){var index=target.className; if (index){index=parseInt(index); if (index>12){target=target.nextSibling; }}}while (target!=null){if ((target.tagName=="SPAN" || target.tagName=="A") && rtvInsideNode(target)){return target.parentNode.id; }target=target.parentNode; }return null; } ; function rtvInsideNode(Od){if (Od.parentNode && Od.parentNode.tagName=="\x44IV" && Od.parentNode.id.indexOf(RadTreeView_Active.ID)>-1){return Od.parentNode.id; }} ; function rtvDispatcher(t,w,e,O4,l4,i4){if (!e){e=window.event; }if (tlrkTreeViews){var o5=rtvGetNodeID(e); var ld=tlrkTreeViews[t]; if (!ld.i0)return; if (rtvIsAnyContextMenuVisible() && w!="\x6d\x63lick" && w!="\x63\x63lick")return; if (ld.EditMode)return; RadTreeView_Active=ld; switch (w){case "mo\x76\x65r":if (o5!=null)ld.MouseOverDispatcher(e,o5); break; case "\x6dout":if (o5!=null)ld.MouseOutDispatcher(e,o5); break; case "mclick":ld.MouseClickDispatcher(e); break; case "\x6ddclick":if (o5!=null)ld.DoubleClickDispatcher(e,o5); break; case "mdown":ld.MouseDown(e); break; case "\x6dup":ld.oe(e); break; case "cont\x65\x78t":if (o5!=null){ld.ContextMenu(e,o5); return false; }break; case "ccli\x63\x6b":ld.ContextMenuClick(e,O4,l4,i4); break; case "\x73croll":ld.Scroll(e); break; case "\x66ocus":ld.Focus(e); case "keydown":ld.KeyDown(e); }}} ; function rtvAppendStyleSheet(Oe,le){var ie=(navigator.appName=="Microsoft In\x74\145\x72\x6eet \x45xplorer") && ((navigator.userAgent.toLowerCase().indexOf("\x6dac")!=-1) || (navigator.appVersion.toLowerCase().indexOf("\x6d\x61c")!=-1)); var Ie=(navigator.userAgent.toLowerCase().indexOf("\x73\141fa\x72\x69")!=-1); if (ie || Ie){document.write("<"+"link"+"\x20rel=\047stylesh\x65\x65t\047\x20typ\x65\075\047\x74ex\x74\x2f\x63\163s\x27 href\x3d\x27"+le+"\047\x3e"); }else {var of=document.createElement("LINK"); of.rel="stylesh\x65\x65t"; of.type="\164e\x78\x74/css"; of.href=le; document.getElementById(Oe+"\x53tyleSheetH\x6f\x6cder").appendChild(of); }} ; function rtvInsertHTML(Of,html){if (Of.tagName=="A"){Of=Of.parentNode; }if (document.all){Of.insertAdjacentHTML("befo\x72\x65End",html); }else {var r=Of.ownerDocument.createRange(); r.setStartBefore(Of); var If=r.createContextualFragment(html); Of.appendChild(If); }} ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -