1、dtree.js源码

/*--------------------------------------------------|

| dTree 2.05 | www.destroydrop.com/javascript/tree/ |

|---------------------------------------------------|

| Copyright (c) 2002-2003 Geir Landr?              |

|                                                   |

| This script can be used freely as long as all     |

| copyright messages are intact.                    |

|                                                   |

| Updated: 17.04.2003                               |

|--------------------------------------------------*/

/**
 * Node object<br>
 * 节点对象<br>
 */
function Node(id, pid, name, url, title, target, icon, iconOpen, open) {

this.id = id;     // 节点id

this.pid = pid;     // 节点父id

this.name = name;    // 节点显示名称;

this.url = url;     // 节点超链接地址;

this.title = title;    // 节点Tips文本;

this.target = target;   // 节点链接所打开的目标frame(_blank, _parent, _self, _top)

this.icon = icon;    // 节点默认图标;

this.iconOpen = iconOpen;  // 节点展开图标;

this._io = open || false;  // 节点展开标识;

this._is = false;    // 节点选中标识;

this._ls = false;    // 同级最后节点标识;

this._hc = false;    // 包含子节点标识;

this._ai = 0;     // 节点在节点数组中的索引值,初始值为0

this._p;      // 保存父节点对象;
 
};

/**
 * Tree object<br>
 * 树对象<br>
 */
function dTree(objName,imagePath) {

this.config = {

target   : null,  // 默认的节点链接所打开的目标frame(_blank, _parent, _self, _top)

folderLinks  : true,  // true文件夹节点如果有超链地址,点击节点打开超链接而不是展开节点;false忽略超链展开或折叠节点;

useSelection : true,  // true高亮显示选中的节点;false反之;

useCookies  : true,  // true使用Cookies保存节点状态;false反之;

useLines  : true,  // true使用虚线连接节点的缩进;false反之;

useIcons  : true,  // true使用图标;false反之;

useStatusText : false, // false不在状态栏显示节点名称;true反之;

closeSameLevel : false, // true同一级节点只能有一个处于展开状态;false反之;

inOrder   : false, // false在整个节点数组中查找子节点;true在索引大于本节点的数组元素中查找子节点(如果子节点总是在父节点后面添加的话,设为true将加快tree的构建速度);
  
  imagePath   : null  // 图片路径;

}

this.icon = {

root   : (imagePath===undefined?'img/base.gif':imagePath + '/img/base.gif'),     // 根节点图标

folder   : (imagePath===undefined?'img/folder.gif':imagePath + '/img/folder.gif'),    // 枝节点文件夹图标

folderOpen  : (imagePath===undefined?'img/folderopen.gif':imagePath + '/img/folderopen.gif'),  // 枝节点打开状态文件夹图标

node   : (imagePath===undefined?'img/page.gif':imagePath + '/img/page.gif'),     // 叶节点图标

empty   : (imagePath===undefined?'img/empty.gif':imagePath + '/img/empty.gif'),     // 空白图标

line   : (imagePath===undefined?'img/line.gif':imagePath + '/img/line.gif'),     // 竖线图标

join   : (imagePath===undefined?'img/join.gif':imagePath + '/img/join.gif'),     // 丁字线图标

joinBottom  : (imagePath===undefined?'img/joinbottom.gif':imagePath + '/img/joinbottom.gif'),  // L线图标

plus   : (imagePath===undefined?'img/plus.gif':imagePath + '/img/plus.gif'),     // 丁字折叠图标

plusBottom  : (imagePath===undefined?'img/plusbottom.gif':imagePath + '/img/plusbottom.gif'),  // L折叠图标

minus   : (imagePath===undefined?'img/minus.gif':imagePath + '/img/minus.gif'),     // 丁字展开图标

minusBottom  : (imagePath===undefined?'img/minusbottom.gif':imagePath + '/img/minusbottom.gif'),  // L展开图标

nlPlus   : (imagePath===undefined?'img/nolines_plus.gif':imagePath + '/img/nolines_plus.gif'), // 无线折叠图标

nlMinus   : (imagePath===undefined?'img/nolines_minus.gif':imagePath + '/img/nolines_minus.gif') // 无线展开图标

};

this.obj = objName;   // 树对象名称(必须一致)

this.aNodes = [];   // 节点数组

this.aIndent = [];   // 当前节点到根节点次级节点(pid==-1),所有父节点是否是同级节点中的最后一个,如果_ls==true则数组对应元素之为0,反之为1

this.root = new Node(-1); // 默认根节点

this.selectedNode = null; // 选中节点的id(tree初始化之前)或它在字节数组中的索引值_ai(tree初始化之后)

this.selectedFound = false; // true存在选中的节点;false反之

this.completed = false;  // tree html 文本构造完成

};

/**
 * Adds a new node to the node array<br>
 * 添加节点到节点数组<br>
 */
dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {

this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);

};

/**
 * Open all nodes<br>
 * 展开树上所有节点<br>
 */
dTree.prototype.openAll = function() {

this.oAll(true);

};

/**
 * Close all nodes<br>
 * 折叠树上所有节点<br>
 */
dTree.prototype.closeAll = function() {

this.oAll(false);

};

/**
 * Outputs the tree to the page<br>
 * 生成tree的html字符串<br>
 */
dTree.prototype.toString = function() {
 
 var str = '<div class="dtree">/n';

if (document.getElementById) {

if (this.config.useCookies) this.selectedNode = this.getSelected();

str += this.addNode(this.root);

} else str += 'Browser not supported.';

str += '</div>';

if (!this.selectedFound) this.selectedNode = null;

this.completed = true;
 
 return str;

};

/**
 * Creates the tree structure<br>
 * 生成节点及其子节点的html字符串<br>
 */
dTree.prototype.addNode = function(pNode) {

var str = '';

var n=0;
 
 // 默认在整个数组中搜索子节点
 if (this.config.inOrder) n = pNode._ai;
 
 // 遍历节点数组
 for (n; n<this.aNodes.length; n++) {
  
  // 只处理直接下级节点
  if (this.aNodes[n].pid == pNode.id) {
   
   // 临时变量
   var cn = this.aNodes[n];
   
   // 设置节点的父节点属性
   cn._p = pNode;
   
   // 设置节点的数组索引属性
   cn._ai = n;
   
   // 设置节点包含子节点标识_hc和同级最后节点标识_ls
   this.setCS(cn);

// 设置节点target 属性
   if (!cn.target && this.config.target) cn.target = this.config.target;
   
   // 判断一个包含子节点的节点在Cookie中是否是展开状态
   if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
   
   // 判断是否允许包含子节点的节点带有超链接地址 
   if (!this.config.folderLinks && cn._hc) cn.url = null;
   
   // 判断节点是否被选中
   if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
     
     // 初始化节点选中标志
     cn._is = true;
     
     // 从这里开始this.selectedNode值由id变为_ai(节点数组索引)
     this.selectedNode = n;
     
     // 初始化tree的选中标志
     this.selectedFound = true;

}

str += this.node(cn, n);
   
   // 判断本级最后一个节点,结束循环
   if (cn._ls) break;

}

}

return str;

};

/**
 * Creates the node icon, url and text<br>
 * 生成节点的html字符串<br>
 * @param node 节点对象;
 * @param nodeId 节点在节点数组中的索引值;
 */
dTree.prototype.node = function(node, nodeId) {

// 节点前的线条或空白图标
 var str = '<div class="dTreeNode">' + this.indent(node, nodeId);

if (this.config.useIcons) {

// 根据节点类型和状态确定节点的默认图标
  if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);

if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;

if (this.root.id == node.pid) {

node.icon = this.icon.root;

node.iconOpen = this.icon.root;

}

str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />';

}

// 节点文本及动作方法(带超链接、不带超链接)
 if (node.url) {

str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';

if (node.title) str += ' title="' + node.title + '"';

if (node.target) str += ' target="' + node.target + '"';

if (this.config.useStatusText) str += '
onmouseover="window.status=/'' + node.name + '/';return true;"
onmouseout="window.status=/'/';return true;" ';

if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))

str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');"';

str += '>';

} else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id){

str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';
  
 }

str += node.name;

if ((node.url || ((!this.config.folderLinks || !node.url) &&
node._hc)) && node.pid != this.root.id) str += '</a>';

str += '</div>';
 
 // --------- 以上是节点面板 --------
 
 // --------- 以下是包含子节点的面板 --------

if (node._hc) {

str += '<div id="d' + this.obj + nodeId + '" class="clip"
style="display:' + ((this.root.id == node.pid || node._io) ? 'block' :
'none') + ';">';
  
  // 延迟加载子节点(前一条件针对普通节点,后一条件针对次级根节点)
  if ((node._hc && node._io && node.pid!=-1) || (node._hc && node.pid==-1)) {
   str += this.addNode(node);
  }
  
  str += '</div>';

}

this.aIndent.pop();

return str;

};

/**
 * Adds the empty and line icons <br>
 * 根据当前节点到次级根节点的所有父节点是否是同级最后一个节点的属性<br>
 * 确定节点前面显示图标的数量和种类<br>
 * @param node 节点对象;
 * @param nodeId 节点在节点数组中的索引值;
 */
dTree.prototype.indent = function(node, nodeId) {

var str = '';

if (this.root.id != node.pid) {

for (var n=0; n<this.aIndent.length; n++){
   
   str +=
'<img src="' + ( (this.aIndent[n] == 1 &&
this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt=""
/>';
   
  }

(node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);

if (node._hc) {

str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';

if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;

else str += ( (node._io) ? ((node._ls &&
this.config.useLines) ? this.icon.minusBottom : this.icon.minus) :
((node._ls && this.config.useLines) ? this.icon.plusBottom :
this.icon.plus ) );

str += '" alt="" /></a>';

} else str += '<img src="' + ( (this.config.useLines) ?
((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty)
+ '" alt="" />';

}

return str;

};

/**
 * Checks if a node has any children and if it is the last sibling<br>
 * 设置节点包含子节点标识_hc和同级最后节点标识_ls<br>
 */
dTree.prototype.setCS = function(node) {

var lastId;

for (var n=0; n<this.aNodes.length; n++) {

if (this.aNodes[n].pid == node.id) node._hc = true;

if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;

}

if (lastId==node.id) node._ls = true;

};

/**
 * Returns the selected node<br>
 * 从Cookie中取得被选中节点在节点数组中的索引<br>
 */
dTree.prototype.getSelected = function() {

var sn = this.getCookie('cs' + this.obj);

return (sn) ? sn : null;

};

/**
 * Highlights the selected node<br>
 * 使选中的节点高亮显示<br>
 * @param id 节点在节点数组中的索引值;
 */
dTree.prototype.s = function(id) {

// 判断是否允许选中节点
 if (!this.config.useSelection) return;

// 根据索引值从节点数组中取出节点对象
 var cn = this.aNodes[id];

// 判断包含子节点的节点是否允许选中
 if (cn._hc && !this.config.folderLinks) return;

// 交换新旧节点的选中状态,改变css
 if (this.selectedNode != id) {
  
  if (this.selectedNode || this.selectedNode==0) {

eOld = document.getElementById("s" + this.obj + this.selectedNode);

if(eOld){
    eOld.className = "node";
   }

}

eNew = document.getElementById("s" + this.obj + id);

if(eNew){
   eNew.className = "nodeSel";
  }

this.selectedNode = id;

if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);

}

};

/**
 * 把折叠状态节点的子节点加载到子节点面板中<br>
 * @param node 节点对象;
 */
dTree.prototype.delayOpen = function(node) {
 var cn = node;
 var id = node._ai;
 // 延迟加载折叠状态节点的子节点
 if(cn._io==false)
 {
  // 获取展示子节点的div
  var childrenDIV = document.getElementById('d' + this.obj + id);
  
  // 该结点从未展开过
  if(childrenDIV!=null && childrenDIV.innerHTML=="")
  {
   // 将从当前节点到次级根节点之前所有父节点是否是同级节点的最后一个的标志压栈
   var nodeTemp = cn;
   var indentArray = new Array();
   
   // 循环到次级根节点之前
   while(nodeTemp._p.id!=this.root.id)
   {
    indentArray[indentArray.length] = (nodeTemp._ls) ? 0 : 1;
    nodeTemp = nodeTemp._p;
   }
   
   // 反向压栈
   for(var i = indentArray.length - 1; i>=0; i--)
   {
    this.aIndent.push(indentArray[i]);
   }
   
   // 初始化下下级所有结点,并得到所有下一级子节点的html字符串,并将一层孩子写入到页面中
   childrenDIV.innerHTML = this.addNode(cn);
   
   // 清除临时深度
   for(var i = 0; i < indentArray.length; i++)
   {
    this.aIndent.pop();
   }
  }
 }
}

/**
 * Toggle Open or close<br>
 * 展开或折叠包某个含子节点的节点<br>
 * @param id 节点在节点数组中的索引值;
 */
dTree.prototype.o = function(id) {

var cn = this.aNodes[id];
 
 this.delayOpen(cn);

this.nodeStatus(!cn._io, id, cn._ls);

cn._io = !cn._io;

if (this.config.closeSameLevel) this.closeLevel(cn);

if (this.config.useCookies) this.updateCookie();

};

/**
 * Open or close all nodes<br>
 * 展开或折叠包全部含子节点的节点<br>
 * @param status true展开,false折叠;
 */
dTree.prototype.oAll = function(status) {

for (var n=0; n<this.aNodes.length; n++) {

if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
   
   this.delayOpen(this.aNodes[n]);

this.nodeStatus(status, n, this.aNodes[n]._ls)

this.aNodes[n]._io = status;

}

}

if (this.config.useCookies) this.updateCookie();

};

/**
 * Opens the tree to a specific node<br>
 * 为选中或看到某一节点而展开其所有父节点<br>
 * @param nId 节点的id而不是节点数组索引;
 * @param bSelect true展开后选中节点,false反之;
 */
dTree.prototype.openTo = function(nId, bSelect) {

// 根据节点id获取节点对象
 for (var n=0; n<this.aNodes.length; n++) {

if (this.aNodes[n].id == nId) {
   
   // 节点id转化为节点在节点数组中的索引值
   nId=n;

break;

}

}

var cn=this.aNodes[nId];

// 保存指定节点及其到次级根节点前的全部父节点的临时数组变量
 var parentArray = new Array();
 
 // 从低级到高级把父节点压入堆栈
 while(cn.pid!=-1){
  
  parentArray.push(cn);
  
  for (var n=0; n<this.aNodes.length; n++) {
   
   if (this.aNodes[n].id == cn.pid) {
    
    cn = this.aNodes[n];
    
    break;
   }
  }
 }
 
 // 从高级到低级弹出父节点,并选中、打开。
 while(cn=parentArray.pop()){
  
  // 是否要选中
  if(this.completed && bSelect){
   
   this.s(cn._ai);
   
  }
  
  // 展开包含子节点的节点,如果最低级的节点是包含子节点的节点就不再展开
  if(cn._hc && parentArray.length>0){
   
   this.delayOpen(cn);

this.nodeStatus(true, cn._ai, cn._ls);
  
   cn._io = true;
  
   if (this.config.closeSameLevel) this.closeLevel(cn);
  
   if (this.config.useCookies) this.updateCookie();
   
  }
 }

};

/**
 * Closes all nodes on the same level as certain node<br>
 * 折叠同级的其他包含有子节点的节点,使得只有自己处于展开状态<br>
 * @param node 节点对象;
 */
dTree.prototype.closeLevel = function(node) {

for (var n=0; n<this.aNodes.length; n++) {

if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {

this.nodeStatus(false, n, this.aNodes[n]._ls);

this.aNodes[n]._io = false;

this.closeAllChildren(this.aNodes[n]);

}

}

}

/**
 * Closes all children of a node<br>
 * 折叠同级的其他包含有子节点的节点,使得只有当前节点处于展开状态<br>
 * @param node 节点对象;
 */
dTree.prototype.closeAllChildren = function(node) {

for (var n=0; n<this.aNodes.length; n++) {

if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {

if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);

this.aNodes[n]._io = false;

this.closeAllChildren(this.aNodes[n]);

}

}

}

/**
 * Change the status of a node(open or closed)<br>
 * 改变节点的状态(展开或折叠)<br>
 * @param status true展开,false折叠;
 * @param id 节点的数组索引值(_ai);
 * @param bottom 是否是本级最后一个节点(_ls);
 */
dTree.prototype.nodeStatus = function(status, id, bottom) {

eDiv = document.getElementById('d' + this.obj + id);

eJoin = document.getElementById('j' + this.obj + id);

if (this.config.useIcons) {

eIcon = document.getElementById('i' + this.obj + id);

eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;

}

eJoin.src = (this.config.useLines)?

((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):

((status)?this.icon.nlMinus:this.icon.nlPlus);

eDiv.style.display = (status) ? 'block': 'none';

};

/**
 * [Cookie] Clears a cookie<br>
 * 清空Cookie中保存的展开状态节点id集合、选中的节点id(不是节点的字节数组索引_ai)<br>
 */
dTree.prototype.clearCookie = function() {

var now = new Date();

var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);

this.setCookie('co'+this.obj, 'cookieValue', yesterday);

this.setCookie('cs'+this.obj, 'cookieValue', yesterday);

};

/**
 * [Cookie] Sets value in a cookie<br>
 * 在Cookie中保存一个键值对<br>
 */
dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {

document.cookie =

escape(cookieName) + '=' + escape(cookieValue)

+ (expires ? '; expires=' + expires.toGMTString() : '')

+ (path ? '; path=' + path : '')

+ (domain ? '; domain=' + domain : '')

+ (secure ? '; secure' : '');

};

/**
 * [Cookie] Gets a value from a cookie<br>
 * 从Cookie中获取一个键名的值<br>
 */
dTree.prototype.getCookie = function(cookieName) {

var cookieValue = '';

var posName = document.cookie.indexOf(escape(cookieName) + '=');

if (posName != -1) {

var posValue = posName + (escape(cookieName) + '=').length;

var endPos = document.cookie.indexOf(';', posValue);

if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));

else cookieValue = unescape(document.cookie.substring(posValue));

}

return (cookieValue);

};

/**
 * [Cookie] Returns ids of open nodes as a string<br>
 * 保存展开状态节点的ID到Cookie中<br>
 */
dTree.prototype.updateCookie = function() {

var str = '';

for (var n=0; n<this.aNodes.length; n++) {

if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {

if (str) str += '.';

str += this.aNodes[n].id;

}

}

this.setCookie('co' + this.obj, str);

};

/**
 * [Cookie] Checks if a node id is in a cookie<br>
 * 检查一个节点的id是否保存在Cookie中,以判断节点展开或折叠<br>
 */
dTree.prototype.isOpen = function(id) {

var aOpen = this.getCookie('co' + this.obj).split('.');

for (var n=0; n<aOpen.length; n++)

if (aOpen[n] == id) return true;

return false;

};

// If Push and pop is not implemented by the browser
// 如果数组类型没有定义 Push 和 pop 方法,就使用自定义的Push 和 pop实现
if (!Array.prototype.push) {

Array.prototype.push = function array_push() {

for(var i=0;i<arguments.length;i++)

this[this.length]=arguments[i];

return this.length;

}

};

if (!Array.prototype.pop) {

Array.prototype.pop = function array_pop() {

lastElement = this[this.length-1];

this.length = Math.max(this.length-1,0);

return lastElement;

}

};

2、example.html源码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>
<title>NewBee Tree</title>

<link rel="StyleSheet" href="dtree.css" type="text/css" />
 <script type="text/javascript" src="dtree.js"></script>
 <script type="text/javascript">
 var qTree = new dTree('qTree');
 
 qTree.config.closeSameLevel=true;
 qTree.config.inOrder=true;
 qTree.config.useCookies=true;
 
 qTree.add(0,-1,'My example tree');
  
 qTree.add(1,0,'Node 1');
 qTree.add(2,0,'Node 2','example.html');
 qTree.add(3,1,'Node 1.1','example.html');
 qTree.add(4,0,'Node 3','example.html');
 qTree.add(5,3,'Node 1.1.1','example.html');
 qTree.add(6,5,'Node 1.1.1.1','example.html');
 qTree.add(7,0,'Node 4','example.html');
 qTree.add(8,1,'Node 1.2','example.html');
 qTree.add(9,0,'My Pictures','example.html','Pictures I/'ve taken over the years','','img/imgfolder.gif','img/imgfolder.gif');
 qTree.add(736422399304017,9,'The trip to Iceland','example.html','Pictures of Gullfoss and Geysir');
 qTree.add(736422399304019,7,'Recycle Bin','example.html','','','img/trash.gif');
 qTree.add(736422399304018,7,'Mom/'s birthday','example.html');
 
 for(var i=10;i<50;i++){
  qTree.add(i,9,'The trip to Iceland','example.html','Pictures of Gullfoss and Geysir');
 } 
  
 
 function abc(){
  if(qTree.completed && document.getElementById("sss")){
   document.getElementById("sss").innerText=qTree.toString();
  }else{
   setTimeout("abc()",50);
  }
 }
 
 </script>

</head>

<body>

<h2>Example</h2>

<div class="dtree">

<p><a href="javascript: qTree.openTo(3,true);">open
all</a> | <a href="javascript: qTree.closeAll();">close
all</a></p>

<script type="text/javascript">
  <!--
  var a01 = new Date().getTime();
  document.write(qTree);
  alert(new Date().getTime()-a01);
  abc();
  //-->
 </script>

</div>

<div id="sss"  style="background-color:#2CE21D">aaa</div>

</body>

</html>

3、DTree效率改进措施
 
3.1、使用延迟加载技术,line332-335,line470-513
3.2、子节点总是在父节点后面添加,this.config.inOrder=true
3.3、同级节点只保留一个处于展开状态,this.config.closeSameLevel=true
3.4、如果不保留节点的状态, qTree.config.useCookies=true

dTree的更多相关文章

  1. 插件dTree的使用

    解压缩dtree.zip 包.  dtree目录下包括这些文件:example01.html . dtree.js . api.html . dtree.css 和img目录       注意:除了a ...

  2. dtree的使用和扩展

    相信用过dtree的童靴的不在少数,网络上流传的JS树有很多,例如雪花树MzTreeView,EXT.Struts2出来之后,也有自己的树控件,但是这么多风姿卓约的倩影中,我独爱,独爱dtree那一棵 ...

  3. dtree的使用

      第一步:到官网下载下载dtree的相关包. 第二步:导入相关包 <link rel="StyleSheet" href="${ctx}/dtree/dtree. ...

  4. Js树型控件Dtree使用

    dtree地址:http://destroydrop.com/javascripts/tree/ Key features Unlimited number of levels 无限级 Can be ...

  5. 用dTree组件生成无限级导航树

     在做管理系统时不可避免要用到导航树,这种东西只要一次做好,就可以随处运行,目前比较好的组件是dTree,原则上可以达到无限级,当然实际运行中4,5级就已经很多了,dTree的速度还是不错的,而且是J ...

  6. dtree基础

    最近用到了dtree来建立树,纠结过好久后,终于有了些门道,下面的总结希望对咪咪们有些帮助: dtree用来建立静态树或者动态树都是很方便的,老外给提供了整个的JS,然后我们只是操心这个树中存放的元素 ...

  7. [11-1] adaboost DTree

    main idea:用与$u_t$成正比的概率sampling生成的数据集$\widetilde{D}$训练DTree:用整个数据集$D$计算weighted$\epsilon_n$,计算$g_t$的 ...

  8. struts2由&lt;s:tree&gt;要么dtree小工具 建立树

    一个 .<s:tree>方法: 1.引入新的标签: <%@ taglib prefix="sd" uri="/struts-dojo-tags" ...

  9. Web版RSS阅读器(二)——使用dTree树形加载rss订阅分组列表

    在上一边博客<Web版RSS阅读器(一)——dom4j读取xml(opml)文件>中已经讲过如何读取rss订阅文件了.这次就把订阅的文件读取到页面上,使用树形结构进行加载显示. 不打算使用 ...

  10. dtree实现上下级关系的显示

    在实际开发中我们常常要涉及到到在页面上显示上下级关系这样的需求 ,我的实现方法: 环境:S2SH+mysql 数据库结构如下图: 其中mgr字段是指经理,也就是自己的上一级 映射信息: Action和 ...

随机推荐

  1. Window+Protobuf使用说明

    Window+Protobuf使用说明 C++WindowCmakeProtocbuf 介绍 起因 由于项目中要用到二进制存储数据,之前使用的方式是按照字节数依次将数据写入字节流中, 但是这样做起来做 ...

  2. (转)SQLite数据库的加密

    1.创建空的SQLite数据库. //数据库名的后缀你可以直接指定,甚至没有后缀都可以 //方法一:创建一个空sqlite数据库,用IO的方式 FileStream fs = File.Create( ...

  3. 解决Idea配置文件不显示中文的问题

    1.首先我们的IDEA文件编码一般都修改为utf-8(setting-->file encodings--->Global Encoding 和 Project Encoding 都设置为 ...

  4. Apple Watch Series 6或将增加焦虑监测和睡眠追踪功能

    一条新的泄露消息称,Apple Watch Series 6 将增加心理健康功能,延长电池续航时间,并对现有传感器进行扩展,这样设备可以测量血液含氧量.苹果即将更新的 Apple Watch 新款推测 ...

  5. 面向对象(OO)第二阶段学习总结

    0.前言 此阶段总共进行三次大作业,其中第一次作业中的第一题,水文数据校验及处理中,遇到较大的难题,第一次接触正则表达式,编码过程中显得难度特别大.第二次作业同样也是对于一元多项式求导中对单项的正则校 ...

  6. 三、通过Vue基础属性做一个Table的增加、删除、姓名音位吗查询

    html头文件包括css,和vue.js的文件的引用 <!DOCTYPE html> <html lang="en"> <head> <m ...

  7. 理解卷积神经网络中的channel

    在一般的深度学习框架的 conv2d 中,如 tensorflow.mxnet,channel 都是必填的一个参数 在 tensorflow 中,对于输入样本中 channels 的含义,一般是RGB ...

  8. 《C程序设计语言》 练习1-21

    问题描述 编写程序entab,将空格串替换为最少数量的制表符和空格,但要保持单词之间的间隔不变.假设制表符终止位的位置与练习1 - 20的detab程序的情况相同.当使用一个制表符或者一个空格都可以到 ...

  9. 【Hexo】使用Hexo+github pages+travis ci 实现自动化部署

    目录 一.说明 二.成品展示 三.前期准备 本地安装 node.js 本地安装 git github 账号 创建仓库 travis ci 账号 四.安装 Hexo 五.使用 hexo 搭建博客 六.部 ...

  10. MAC使用Scrapy遇到的坑

    MAC版本:EI Captain Python版本: 2.7.10 MAC默认没有安装pip,所以首先 sudo easy_install pip 然后安装Scrapy: sudo pip insta ...