⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dhtmlxtree.js

📁 利用AJAX实现目录树
💻 JS
📖 第 1 页 / 共 3 页
字号:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 dhtmlXTreeObject.prototype.getLevel=function(itemId){
 var temp=this.a0Find(itemId);
 if(!temp)return 0;
 return this.a27(temp,0);
};
 
 

 
 dhtmlXTreeObject.prototype.setItemCloseable=function(itemId,flag)
{
 flag=convertStringToBoolean(flag);
 var temp=this.a0Find(itemId);
 if(!temp)return 0;
 temp.closeble=flag;
};
 
 
 dhtmlXTreeObject.prototype.a27=function(itemObject,count){
 if(itemObject.parentObject)return this.a27(itemObject.parentObject,count+1);
 return(count);
};
 
 
 dhtmlXTreeObject.prototype.hasChildren=function(itemId){
 var temp=this.a0Find(itemId);
 if(!temp)return 0;
 else 
{
 if((this.XMLsource)&&(!temp.XMLload))return true;
 else 
 return temp.childsCount;
};
};
 
 
 
 dhtmlXTreeObject.prototype.setItemText=function(itemId,newLabel)
{
 var temp=this.a0Find(itemId);
 if(!temp)return 0;
 temp.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML=newLabel;
};
 
 dhtmlXTreeObject.prototype.refreshItem=function(itemId){
 if(!itemId)itemId=this.rootId;
 var temp=this.a0Find(itemId);
 this.deleteChildItems(itemId);
 this.loadXML(this.XMLsource+getUrlSymbol(this.XMLsource)+"id="+escape(itemId));
};
 
 
 dhtmlXTreeObject.prototype.setItemImage2=function(itemId,image1,image2,image3){
 var temp=this.a0Find(itemId);
 if(!temp)return 0;
 temp.images[1]=image2;
 temp.images[2]=image3;
 temp.images[0]=image1;
 this.a10(temp);
};
 
 dhtmlXTreeObject.prototype.setItemImage=function(itemId,image1,image2)
{
 var temp=this.a0Find(itemId);
 if(!temp)return 0;
 if(image2)
{
 temp.images[1]=image1;
 temp.images[2]=image2;
}
 else temp.images[0]=image1;
 this.a10(temp);
};
 
 
 
 dhtmlXTreeObject.prototype.getSubItems =function(itemId)
{
 var temp=this.a0Find(itemId);
 if(!temp)return 0;

 var z="";
 for(i=0;i<temp.childsCount;i++)
 if(!z)z=temp.childNodes[i].id;
 else z+=","+temp.childNodes[i].id;
 return z;
};
 
 dhtmlXTreeObject.prototype.getAllSubItems =function(itemId){
 return this.a28(itemId);
}
 
 
 dhtmlXTreeObject.prototype.a28 =function(itemId,z,node)
{
 if(node)temp=node;
 else{
 var temp=this.a0Find(itemId);
};
 if(!temp)return 0;
 
 z="";
 for(var i=0;i<temp.childsCount;i++)
{
 if(!z)z=temp.childNodes[i].id;
 else z+=","+temp.childNodes[i].id;
 var zb=this.getAllSubItems(id,z,temp.childNodes[i])
 if(zb)z+=","+zb;
}
 return z;
};
 

 
 
 dhtmlXTreeObject.prototype.selectItem=function(itemId,mode){
 mode=convertStringToBoolean(mode);
 var temp=this.a0Find(itemId);
 if(!temp)return 0;
 if(mode)
 this.onRowSelect(0,temp.htmlNode.childNodes[0].childNodes[0].childNodes[3],false);
 else
 this.onRowSelect(0,temp.htmlNode.childNodes[0].childNodes[0].childNodes[3],true);
};
 
 
 dhtmlXTreeObject.prototype.getSelectedItemText=function()
{
 if(this.lastSelected)
 return this.lastSelected.parentObject.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML;
 else return("");
};




 
 dhtmlXTreeObject.prototype.a29=function(Count,Nodes)
{
 Count--;
 for(var i=0;i<Count;i++)
{
 if(Nodes[i]==0){Nodes[i]=Nodes[i+1];Nodes[i+1]=0;}
};
};
 
 dhtmlXTreeObject.prototype.a30=function(itemId,htmlObject,skip){

 if(!skip){
 this.a0RecSub(htmlObject);
}
 
 if((!htmlObject)||(!htmlObject.parentObject))return 0;
 var tempos=0;var tempos2=0;
 if(htmlObject.tr.nextSibling)tempos=htmlObject.tr.nextSibling.nodem;
 if(htmlObject.tr.previousSibling)tempos2=htmlObject.tr.previousSibling.nodem;
 
 var sN=htmlObject.parentObject;
 var Count=sN.childsCount;
 var Nodes=sN.childNodes;
 for(var i=0;i<Count;i++)
{
 if(Nodes[i].id==itemId){
 if(!skip)sN.htmlNode.childNodes[0].removeChild(Nodes[i].tr);
 Nodes[i]=0;
 break;
}
}
 this.a29(Count,Nodes);
 if(!skip){
 sN.childsCount--;
}

 if(tempos){
 this.a10(tempos);
 this.a11(tempos);
}
 if(tempos2){
 this.a10(tempos2);
 this.a11(tempos2);
}
 if(this.tscheck)this.a12(sN);
};
 
 dhtmlXTreeObject.prototype.setCheck=function(itemId,state){
 state=convertStringToBoolean(state);
 var sNode=this.a0Find(itemId);
 if(!sNode)return;
 if(this.tscheck)return this.a32(state,sNode);
 else this.a19(sNode,state);
 this.a12(sNode.parentObject);
};
 
 dhtmlXTreeObject.prototype.a19=function(sNode,state){
 var z=sNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];
 if(state=="notsure")sNode.checkstate=2;
 else if(state)sNode.checkstate=1;else sNode.checkstate=0;
 
 z.src=this.imPath+this.checkArray[sNode.checkstate];
};
 
 
dhtmlXTreeObject.prototype.setSubChecked=function(itemId,state){
 var sNode=this.a0Find(itemId);
 this.a32(state,sNode);
 this.a12(sNode.parentObject);
}
 
 dhtmlXTreeObject.prototype.a32=function(state,sNode){
 state=convertStringToBoolean(state);
 if(!sNode)return;
 for(var i=0;i<sNode.childsCount;i++)
{
 this.a32(state,sNode.childNodes[i]);
};
 var z=sNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];
 if(state)sNode.checkstate=1;
 else sNode.checkstate=0;
 z.src=this.imPath+this.checkArray[sNode.checkstate];
};

 
 dhtmlXTreeObject.prototype.isItemChecked=function(itemId){
 var sNode=this.a0Find(itemId);
 if(!sNode)return;
 return sNode.checkstate;
};
 




 
 dhtmlXTreeObject.prototype.getAllChecked=function(){
 return this.a33();
}
 
 dhtmlXTreeObject.prototype.a33=function(htmlNode,list){
 if(!htmlNode)htmlNode=this.htmlNode;
 if(htmlNode.checkstate==1){if(list)list+=","+htmlNode.id;else list=htmlNode.id;}
 var j=htmlNode.childsCount;
 for(var i=0;i<j;i++)
{
 list=this.a33(htmlNode.childNodes[i],list);
};
 if(list)return list;else return "";
};
 
 dhtmlXTreeObject.prototype.deleteChildItems=function(itemId)
{
 var sNode=this.a0Find(itemId);
 if(!sNode)return;
 var j=sNode.childsCount;
 for(var i=0;i<j;i++)
{
 this.a30(sNode.childNodes[0].id,sNode.childNodes[0]);
};
};
 
 
dhtmlXTreeObject.prototype.deleteItem=function(itemId,selectParent){
 this.a24(itemId,selectParent);
}
 
dhtmlXTreeObject.prototype.a24=function(itemId,selectParent,skip){
 selectParent=convertStringToBoolean(selectParent);
 var sNode=this.a0Find(itemId);
 if(!sNode)return;
 if(selectParent)this.selectItem(this.getParentId(this.getSelectedItemId()),1);
 if(!skip){
 this.a0RecSub(sNode);
};
 var zTemp=sNode.parentObject;
 this.a30(itemId,sNode,skip);
 this.a10(zTemp);
 this.a11(zTemp);
};
 
 
 dhtmlXTreeObject.prototype.a0RecSub=function(itemObject){
 for(var i=0;i<itemObject.childsCount;i++)
{
 this.a0RecSub(itemObject.childNodes[i]);
 this.a0Sub(itemObject.childNodes[i].id);
};
 this.a0Sub(itemObject.id);
};
 
 
 dhtmlXTreeObject.prototype.insertNewNext=function(parentItemId,itemId,itemName,itemActionHandler,image1,image2,image3,optionStr,childs){
 var sNode=this.a0Find(parentItemId);
 if(!sNode)return(0);
 this.a8(0,itemId,itemName,itemActionHandler,image1,image2,image3,optionStr,childs,sNode);
};

 
 
 
 dhtmlXTreeObject.prototype.getItemIdByIndex=function(itemId,index){
 var z=this.a0Find(itemId);
 if(!z)return 0;
 var temp=z.htmlNode.childNodes[0].childNodes[0];
 while(index>0)
{
 temp=temp.nextSibling;
 if((!temp)||(!temp.nodem))return 0;
 index--;
}
 return temp.nodem.id;
};
 
 dhtmlXTreeObject.prototype.getChildItemIdByIndex=function(itemId,index){
 var sNode=this.a0Find(itemId);
 if(!sNode)return(0);
 if(this.hasChildren(itemId)<index)return 0;
 return sNode.htmlNode.childNodes[0].childNodes[index].nodem.id;
};


 
 

 
 dhtmlXTreeObject.prototype.setDragHandler=function(func){if(typeof(func)=="function")this.dragFunc=func;else this.dragFunc=eval(func);};
 
 
 dhtmlXTreeObject.prototype.a34=function(htmlNode){
 if(htmlNode.parentObject.span){
 htmlNode.parentObject.span.className='standartTreeRow';
 if(htmlNode.parentObject.acolor)htmlNode.parentObject.span.style.color=node.acolor;
}
};
 
 
 dhtmlXTreeObject.prototype.enableDragAndDrop=function(mode){this.dragAndDropOff=convertStringToBoolean(mode);};
 
 
 dhtmlXTreeObject.prototype.a35=function(htmlNode){
 if(htmlNode.parentObject.span){
 htmlNode.parentObject.span.className='selectedTreeRow';
 if(htmlNode.parentObject.scolor)htmlNode.parentObject.span.style.color=node.scolor;
}
};
 
 
 
dhtmlXTreeObject.prototype.a36=function(htmlObject){
 dhtmlObject=htmlObject.parentObject;
 if(this.lastSelected)this.a34(this.lastSelected);
 var dragSpan=document.createElement('div');
 dragSpan.appendChild(document.createTextNode(dhtmlObject.label));
 dragSpan.style.position="absolute";
 dragSpan.className="dragSpanDiv";
 return dragSpan;
}

















 
dhtmlXTreeObject.prototype.a21=function(e){
 if((e)&&(e.preventDefault)){e.preventDefault();return false;}
}

dhtmlXTreeObject.prototype.a37=function(sourceHtmlObject,dhtmlObject,targetHtmlObject){
 if(!targetHtmlObject.parentObject){targetHtmlObject=this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];}
 else this.a34(targetHtmlObject);
 if(dhtmlObject.lastSelected)dhtmlObject.a35(dhtmlObject.lastSelected);
 if((!this.dragMove)||(this.dragMove()))this.a23(sourceHtmlObject.parentObject,targetHtmlObject.parentObject);

}

dhtmlXTreeObject.prototype.a37In=function(htmlObject,shtmlObject){
 if(!htmlObject.parentObject)
{
return htmlObject;
}
 if((!this.a22(shtmlObject.parentObject.id,htmlObject.parentObject))&&(htmlObject.parentObject.id!=shtmlObject.parentObject.id))
{
 this.a35(htmlObject);
 if(this.a9(htmlObject.parentObject)<0)
 this.a39=window.setTimeout(new callerFunction(this.a40,this),1000);
 this.a41=htmlObject.parentObject.id;
 return htmlObject;
}
 else return 0;
}
dhtmlXTreeObject.prototype.a40=function(e,treeObject){
 treeObject.openItem(treeObject.a41);
};
dhtmlXTreeObject.prototype.a37Out=function(htmlObject){
 if(!htmlObject.parentObject)return 0;
this.a34(htmlObject);if(this.a39)clearTimeout(this.a39);};

 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -