扩展dtree支持checkbox

带checkbox的dtree 在dtree原有基础上添加了checkbox功能 立即下载

扩展dtree支持checkbox

最近仔细看了一下dtree的代码,它不支持checkbox很不爽,就自己动手加上了。修改后的代码与原来的dtree兼容,可以直接替换原工程中的dtree。详细示例请看附件。
Js代码 复制代码
  1. /*--------------------------------------------------|  
  2. | dTree 2.05 | www.destroydrop.com/javascript/tree/ |  
  3. |---------------------------------------------------|  
  4. | Copyright (c) 2002-2003 Geir Landr?               |  
  5. |                                                   |  
  6. | This script can be used freely as long as all     |  
  7. | copyright messages are intact.                    |  
  8. |                                                   |  
  9. | Updated: 17.04.2003                               |  
  10. |--------------------------------------------------*/  
  11. //modified by wallimn. 20070831   
  12. //to support checkbox object   
  13. //updated 2009-02-13   
  14. //welcome to visit my blog: http://blog.csdn.net/wallimn   
  15. //please keep these message.   
  16. // Node object   
  17. function Node(id, pid, name, url, title, target, icon, iconOpen, open) {   
  18.     this.id = id;   
  19.     this.pid = pid;   
  20.     this.name = name;   
  21.     this.url = url;   
  22.     this.title = title;   
  23.     this.target = target;   
  24.     this.icon = icon;   
  25.     this.iconOpen = iconOpen;   
  26.     this._io = open || false;   
  27.     this._is = false;   
  28.     this._ls = false;   
  29.     this._hc = false;   
  30.     this._ai = 0;   
  31.     this._p;   
  32. };   
  33. // Tree object   
  34. function dTree(objName,iconPath) {   
  35.     this.config = {   
  36.         target                  : null,   
  37.         folderLinks         : true,   
  38.         useSelection        : true,   
  39.         useCookies          : true,   
  40.         useLines                : true,   
  41.         useIcons                : true,   
  42.         useStatusText       : false,   
  43.         closeSameLevel  : false,   
  44.         inOrder                 : false,   
  45.         check:false     //added by wallimn 2009-02-05, to control whether checkbox is showed   
  46.     };   
  47.     //modified by wallimn 2009-02-05, in order to make client can modify path of icons;   
  48.     if(!iconPath)iconPath="img/";//set the default value, be compatible with dtree   
  49.     this.icon = {   
  50.             root        : iconPath+'base.gif',   
  51.             folder      : iconPath+'folder.gif',   
  52.             folderOpen  : iconPath+'folderopen.gif',   
  53.             node        : iconPath+'page.gif',   
  54.             empty       : iconPath+'empty.gif',   
  55.             line        : iconPath+'line.gif',   
  56.             join        : iconPath+'join.gif',   
  57.             joinBottom  : iconPath+'joinbottom.gif',   
  58.             plus        : iconPath+'plus.gif',   
  59.             plusBottom  : iconPath+'plusbottom.gif',   
  60.             minus       : iconPath+'minus.gif',   
  61.             minusBottom : iconPath+'minusbottom.gif',   
  62.             nlPlus      : iconPath+'nolines_plus.gif',   
  63.             nlMinus     : iconPath+'nolines_minus.gif'  
  64.         };   
  65.     //added by wallimn, to cache checkbox object and improve speed of set checked status   
  66.     this.cbCollection = new Object();   
  67.     this.obj = objName;   
  68.     this.aNodes = [];   
  69.     this.aIndent = [];   
  70.     this.root = new Node(-1);   
  71.     this.selectedNode = null;   
  72.     this.selectedFound = false;   
  73.     this.completed = false;   
  74. };   
  75.   
  76. // Adds a new node to the node array   
  77. dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {   
  78.     this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);   
  79. };   
  80.   
  81. // Open/close all nodes   
  82. dTree.prototype.openAll = function() {   
  83.     this.oAll(true);   
  84. };   
  85. dTree.prototype.closeAll = function() {   
  86.     this.oAll(false);   
  87. };   
  88.   
  89. // Outputs the tree to the page   
  90. dTree.prototype.toString = function() {   
  91.     var str = '<div class="dtree">/n';   
  92.     if (document.getElementById) {   
  93.         if (this.config.useCookies) this.selectedNode = this.getSelected();   
  94.         str += this.addNode(this.root);   
  95.     } else str += 'Browser not supported.';   
  96.     str += '</div>';   
  97.     if (!this.selectedFound) this.selectedNode = null;   
  98.     this.completed = true;   
  99.     return str;   
  100. };   
  101.   
  102. // Creates the tree structure   
  103. dTree.prototype.addNode = function(pNode) {   
  104.     var str = '';   
  105.     var n=0;   
  106.     if (this.config.inOrder) n = pNode._ai;   
  107.     for (n; n<this.aNodes.length; n++) {   
  108.         if (this.aNodes[n].pid == pNode.id) {   
  109.             var cn = this.aNodes[n];   
  110.             cn._p = pNode;   
  111.             cn._ai = n;   
  112.             this.setCS(cn);   
  113.             if (!cn.target && this.config.target) cn.target = this.config.target;   
  114.             if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);   
  115.             if (!this.config.folderLinks && cn._hc) cn.url = null;   
  116.             if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {   
  117.                     cn._is = true;   
  118.                     this.selectedNode = n;   
  119.                     this.selectedFound = true;   
  120.             }   
  121.             str += this.node(cn, n);   
  122.             if (cn._ls) break;   
  123.         }   
  124.     }   
  125.     return str;   
  126. };   
  127. //get checkbox object by id(input by client)   
  128. //added by wallimn,   
  129. dTree.prototype.co=function(id){   
  130.     if (this.cbCollection[id])return this.cbCollection[id];   
  131.     for(var n=0; n<this.aNodes.length; n++){   
  132.         if(this.aNodes[n].id==id){   
  133.             this.cbCollection[id]=document.getElementById("c"+this.obj+n);   
  134.             break;   
  135.         }   
  136.     }   
  137.     return this.cbCollection[id];   
  138. };   
  139. //get the ids of the checkbox which check status is true;   
  140. //added by wallimn, updated: 2009-02-13   
  141. dTree.prototype.getCheckedNodes=function(){   
  142.     var res = new Array();   
  143.     var cko;//checkobject   
  144.     for(var n=0; n<this.aNodes.length; n++){   
  145.         //alert("c"+this.obj+n+(document.getElementById("c"+this.obj+n).checked));   
  146.         //cache the object to improve speed when you have very,very many nodes and call this function many times in one page   
  147.         //i.e. with ajax technology   
  148.         //document.getElementById("c"+this.obj+n).checked   
  149.         cko = this.co(this.aNodes[n].id);   
  150.         if(cko.checked==true){   
  151.             res[res.length]=this.aNodes[n].id;   
  152.         }   
  153.     }   
  154.     return res;   
  155. }   
  156. //added by wallimn   
  157. dTree.prototype.cc=function(nodeId){   
  158.     var cs = document.getElementById("c"+this.obj+nodeId).checked;   
  159.     var n,node = this.aNodes[nodeId];   
  160.     var len =this.aNodes.length;   
  161.     for (n=0; n<len; n++) {   
  162.         //alert(this.aNodes[n].pid+"--"+this.aNodes[n].id);   
  163.         if (this.aNodes[n].pid == node.id) {   
  164.             //if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);   
  165.             //this.aNodes[n]._io = false;   
  166.             document.getElementById("c"+this.obj+n).checked=cs;   
  167.             this.cc(n);        
  168.         }   
  169.     }   
  170.     if(cs==false)return;   
  171.     var pid=node.pid;   
  172.     var bSearch;   
  173.     do{   
  174.         bSearch=false;   
  175.         for(n=0;n<len;n++){   
  176.             if(this.aNodes[n].id==pid){   
  177.                 document.getElementById("c"+this.obj+n).checked=true;   
  178.                 pid=this.aNodes[n].pid;   
  179.                 bSearch= true;                 
  180.                 break;   
  181.             }   
  182.         }   
  183.     }while(bSearch==true)   
  184. }   
  185.   
  186. // Creates the node icon, url and text   
  187. dTree.prototype.node = function(node, nodeId) {   
  188.     var str = '<div class="dTreeNode">' + this.indent(node, nodeId);   
  189.     if (this.config.useIcons) {   
  190.         if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);   
  191.         if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;   
  192.         if (this.root.id == node.pid) {   
  193.             node.icon = this.icon.root;   
  194.             node.iconOpen = this.icon.root;   
  195.         }   
  196.         str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io)?node.iconOpen : node.icon) + '" alt="" />';   
  197.     }   
  198.     if(this.config.check==true){   
  199.         str+= '<input type="checkbox" class="cx" id="c'+  this.obj + nodeId + '" onclick="javascript:'+this.obj+'.cc('+nodeId+')"/>';   
  200.         //alert(str);   
  201.     }   
  202.     if (node.url) {   
  203.         str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';   
  204.         if (node.title) str += ' title="' + node.title + '"';   
  205.         if (node.target) str += ' target="' + node.target + '"';   
  206.         if (this.config.useStatusText) str += ' onmouseover="window.status=/'' + node.name + '/';return true;" onmouseout="window.status=/'/';return true;" ';   
  207.         if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))   str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');"';   
  208.         str += '>';   
  209.     }   
  210.     else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)   
  211.         str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';   
  212.     str += node.name;   
  213.     if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>';   
  214.     str += '</div>';   
  215.     if (node._hc) {   
  216.         str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">';   
  217.         str += this.addNode(node);   
  218.         str += '</div>';   
  219.     }   
  220.     this.aIndent.pop();   
  221.     //alert(str);   
  222.     return str;   
  223. };   
  224.   
  225. // Adds the empty and line icons   
  226. dTree.prototype.indent = function(node, nodeId) {   
  227.     var str = '';   
  228.     if (this.root.id != node.pid) {   
  229.         for (var n=0; n<this.aIndent.length; n++)   
  230.             str += '<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';   
  231.         (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);   
  232.         if (node._hc) {   
  233.             str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';   
  234.             if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;   
  235.             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 ) );   
  236.             str += '" alt="" /></a>';   
  237.         } else str += '<img src="' + ( (this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty) + '" alt="" />';   
  238.     }   
  239.     return str;   
  240. };   
  241.   
  242. // Checks if a node has any children and if it is the last sibling   
  243. dTree.prototype.setCS = function(node) {   
  244.     var lastId;   
  245.     for (var n=0; n<this.aNodes.length; n++) {   
  246.         if (this.aNodes[n].pid == node.id) node._hc = true;   
  247.         if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;   
  248.     }   
  249.     if (lastId==node.id) node._ls = true;   
  250. };   
  251.   
  252. // Returns the selected node   
  253. dTree.prototype.getSelected = function() {   
  254.     var sn = this.getCookie('cs' + this.obj);   
  255.     return (sn) ? sn : null;   
  256. };   
  257.   
  258. // Highlights the selected node   
  259. dTree.prototype.s = function(id) {   
  260.     if (!this.config.useSelection) return;   
  261.     var cn = this.aNodes[id];   
  262.     if (cn._hc && !this.config.folderLinks) return;   
  263.     if (this.selectedNode != id) {   
  264.         if (this.selectedNode || this.selectedNode==0) {   
  265.             eOld = document.getElementById("s" + this.obj + this.selectedNode);   
  266.             eOld.className = "node";   
  267.         }   
  268.         eNew = document.getElementById("s" + this.obj + id);   
  269.         eNew.className = "nodeSel";   
  270.         this.selectedNode = id;   
  271.         if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);   
  272.     }   
  273. };   
  274.   
  275. // Toggle Open or close   
  276. dTree.prototype.o = function(id) {   
  277.     var cn = this.aNodes[id];   
  278.     this.nodeStatus(!cn._io, id, cn._ls);   
  279.     cn._io = !cn._io;   
  280.     if (this.config.closeSameLevel) this.closeLevel(cn);   
  281.     if (this.config.useCookies) this.updateCookie();   
  282. };   
  283.   
  284. // Open or close all nodes   
  285. dTree.prototype.oAll = function(status) {   
  286.     for (var n=0; n<this.aNodes.length; n++) {   
  287.         if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {   
  288.             this.nodeStatus(status, n, this.aNodes[n]._ls)   
  289.             this.aNodes[n]._io = status;   
  290.         }   
  291.     }   
  292.     if (this.config.useCookies) this.updateCookie();   
  293. };   
  294.   
  295. // Opens the tree to a specific node   
  296. dTree.prototype.openTo = function(nId, bSelect, bFirst) {   
  297.     if (!bFirst) {   
  298.         for (var n=0; n<this.aNodes.length; n++) {   
  299.             if (this.aNodes[n].id == nId) {   
  300.                 nId=n;   
  301.                 break;   
  302.             }   
  303.         }   
  304.     }   
  305.     var cn=this.aNodes[nId];   
  306.     if (cn.pid==this.root.id || !cn._p) return;   
  307.     cn._io = true;   
  308.     cn._is = bSelect;   
  309.     if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls);   
  310.     if (this.completed && bSelect) this.s(cn._ai);   
  311.     else if (bSelect) this._sn=cn._ai;   
  312.     this.openTo(cn._p._ai, false, true);   
  313. };   
  314.   
  315. // Closes all nodes on the same level as certain node   
  316. dTree.prototype.closeLevel = function(node) {   
  317.     for (var n=0; n<this.aNodes.length; n++) {   
  318.         if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {   
  319.             this.nodeStatus(false, n, this.aNodes[n]._ls);   
  320.             this.aNodes[n]._io = false;   
  321.             this.closeAllChildren(this.aNodes[n]);   
  322.         }   
  323.     }   
  324. }   
  325.   
  326. // Closes all children of a node   
  327. dTree.prototype.closeAllChildren = function(node) {   
  328.     for (var n=0; n<this.aNodes.length; n++) {   
  329.         if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {   
  330.             if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);   
  331.             this.aNodes[n]._io = false;   
  332.             this.closeAllChildren(this.aNodes[n]);         
  333.         }   
  334.     }   
  335. }   
  336.   
  337. // Change the status of a node(open or closed)   
  338. dTree.prototype.nodeStatus = function(status, id, bottom) {   
  339.     eDiv    = document.getElementById('d' + this.obj + id);   
  340.     eJoin   = document.getElementById('j' + this.obj + id);   
  341.     if (this.config.useIcons) {   
  342.         eIcon   = document.getElementById('i' + this.obj + id);   
  343.         eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;   
  344.     }   
  345.     eJoin.src = (this.config.useLines)?   
  346.     ((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):   
  347.     ((status)?this.icon.nlMinus:this.icon.nlPlus);   
  348.     eDiv.style.display = (status) ? 'block': 'none';   
  349. };   
  350. // [Cookie] Clears a cookie   
  351. dTree.prototype.clearCookie = function() {   
  352.     var now = new Date();   
  353.     var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);   
  354.     this.setCookie('co'+this.obj, 'cookieValue', yesterday);   
  355.     this.setCookie('cs'+this.obj, 'cookieValue', yesterday);   
  356. };   
  357.   
  358. // [Cookie] Sets value in a cookie   
  359. dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure)    
  360.   
  361. {   
  362.     document.cookie =   
  363.         escape(cookieName) + '=' + escape(cookieValue)   
  364.         + (expires ? '; expires=' + expires.toGMTString() : '')   
  365.         + (path ? '; path=' + path : '')   
  366.         + (domain ? '; domain=' + domain : '')   
  367.         + (secure ? '; secure' : '');   
  368. };   
  369.   
  370. // [Cookie] Gets a value from a cookie   
  371. dTree.prototype.getCookie = function(cookieName) {   
  372.     var cookieValue = '';   
  373.     var posName = document.cookie.indexOf(escape(cookieName) + '=');   
  374.     if (posName != -1) {   
  375.         var posValue = posName + (escape(cookieName) + '=').length;   
  376.         var endPos = document.cookie.indexOf(';', posValue);   
  377.         if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));   
  378.         else cookieValue = unescape(document.cookie.substring(posValue));   
  379.     }   
  380.     return (cookieValue);   
  381. };   
  382.   
  383. // [Cookie] Returns ids of open nodes as a string   
  384. dTree.prototype.updateCookie = function() {   
  385.     var str = '';   
  386.     for (var n=0; n<this.aNodes.length; n++) {   
  387.         if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {   
  388.             if (str) str += '.';   
  389.             str += this.aNodes[n].id;   
  390.         }   
  391.     }   
  392.     this.setCookie('co' + this.obj, str);   
  393. };   
  394.   
  395. // [Cookie] Checks if a node id is in a cookie   
  396. dTree.prototype.isOpen = function(id) {   
  397.     var aOpen = this.getCookie('co' + this.obj).split('.');   
  398.     for (var n=0; n<aOpen.length; n++)   
  399.         if (aOpen[n] == id) return true;   
  400.     return false;   
  401. };   
  402.   
  403. // If Push and pop is not implemented by the browser   
  404. if (!Array.prototype.push) {   
  405.     Array.prototype.push = function array_push() {   
  406.         for(var i=0;i<arguments.length;i++)   
  407.             this[this.length]=arguments[i];   
  408.         return this.length;   
  409.     }   
  410. };   
  411. if (!Array.prototype.pop) {   
  412.     Array.prototype.pop = function array_pop() {   
  413.         lastElement = this[this.length-1];   
  414.         this.length = Math.max(this.length-1,0);   
  415.         return lastElement;   
  416.     }   
  417. };  
dtree和dtree_checkbox(dtree复选框) 该资料包括dtree和dtree_checkbox(dtree复选框),众所周知,dtree是个不错的JS控件,好资料当然要和大家分享^_^ 立即下载

相关推荐

dTreeCheckbox(轻松上手)

这是一个带有checked的dtree,可以获取到选取的checked的信息。很智能,很实用,带说明

Dtree 添加 checkbox 复选框 可以默认选中

一:目标 要实现用一个树形结构的展示数据,每个节点(除了根节点)前有一个checkbox,同时,点击父节点,则子节点全选或者全不选,当选中了全部子节点,父节点选中;如下图所示: 同时可以在创建的时候,让某些节点默认选中或不选中; 注:本人把显示图标改成了false(个人觉得不好看),想用图标的话可以不用修改源文件, useIcons : false// 想用图...

weixin_30291791的博客 3150

dtree新改版-添加checkbox复选框

dtree修改版-添加checkbox: 由于原版dtree作者没有加上复选框功能,我用来做用户模块权限功能的时候很不好用,网上也找到一些基于dtree添加了checkbox的修改版,但是用起来很不顺手,最后不得不根据自己的需要一再修改成了现在这个版本。大家看看是否能用到,如果觉得还要进行修改可以给我提出,在我力所能及范围内我会尽力去修改。

dtree的checkbox

选中checkbox自动选择其子节点 或  父节点str+=  dTree.prototype.cc=function(nodeId){  var cs = document.getElementById("c"+this.obj+nodeId).checked;  var n,node = this.aNodes[nodeId];  var

KOOK_OKKO的专栏 1105

dtree权限控制复选框插件

插件描述:dtree权限控制复选框插件. 参考示例:http://www.jq22.com/jquery-info5331

带复选框的dtree

修改后的dtree,添加了多选框,并可设置多选框默认选择,构造功能树时使用

关于dtree树代码实现带checkox修改的最新思路

最近,我突然要使用树形菜单,一直不知道是自己写好呢,还是自己从网上copy好。经过一些筛选,我觉得拿dtree代码来使用比较方便,同时我也可以学习到前辈们的经验。但是当拿到dtree代码时,我通过测试发现改代码并没有支持checkbox元素。我自己对该代码不是非常熟悉,我觉得还是

YongAn_shine的专栏 559

dtree 带复选框

dtree 带复选框的源码,功能齐全(无限级树形菜单、带复选框、选中值结果打印等),简单易懂,菜鸟老鸟都能直接使用。

html树形菜单控件

html树形菜单控件 转载:http://blog.csdn.net/kalision/article/details/7842149 jQuery plugin: Treeview 这个插件能够把无序列表转换成可展开与收缩的Tree。 主页:http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ 下载:...

773

磁编码器选型避坑指南:为什么MT6816比霍尔传感器更适合你的伺服系统?

本文深入对比了MT6816磁编码器与传统霍尔传感器在伺服系统中的应用。MT6816基于AMR技术,对磁场方向敏感而非强度,具备高精度、强抗干扰、高安装容差和极低延时等优势,尤其适合高转速、恶劣环境下的工业场景,能有效提升系统可靠性与长期稳定性。

rainy的博客 1110

Pyinstaller 打包 Pyzbar 时缺失 DLL 文件的排查与修复指南

本文详细解析了使用Pyinstaller打包Pyzbar库时,因缺失关键DLL文件导致程序闪退的常见问题。文章提供了从问题复现、错误诊断到最终修复的完整解决方案,核心在于通过修改.spec配置文件,手动将缺失的libzbar-64.dll等文件添加到打包过程中,确保生成的可执行文件能独立运行。

wdx012345的博客 506

树形菜单大集合,带checkbox,带右键菜单,重命名,动态修改等

zTree  利用Jquery的核心代码,实现一套能完成大部分常用工作的Tree功能兼容 IE、FireFox、Chrome 等浏览器(对于IE 6.0的兼容问题将不做特殊维护)在一个页面内可同时生成多个 Tree 实例支持 JSON 数据支持一次性静态生成 和 Ajax异步加载 两种方式支持多种事件响应及反馈支持 Tree 的节点移动支持任意更换皮肤(依靠css)支持极其灵活的Checkb

coolhao123的专栏 5894

【STM32G474实战】RS485通信的DMA优化策略与性能对比

本文深入探讨了在STM32G474微控制器上优化RS485通信的DMA策略。通过对比轮询、中断和DMA三种数据传输方式的代码实现与性能,揭示了DMA在解放CPU、降低占用率方面的巨大优势。文章提供了详细的DMA配置指南、高级应用技巧(如结合空闲中断)以及一个高可靠通信框架的实战思路,旨在帮助开发者构建高效、实时的工业控制系统。

weixin_29268331的博客 311

jQuery Tree 树形控件

(1)jQuery File Tree (2)jQuery plugin: Treeview (演示地址) 这个插件能够把无序列表转换成可展开与收缩的Tree。 (3)jstree jstree是一个基于jQuery的Tree控件。支持XML,JSON,Html三种数据源。提供创建,重命名,移动,删除,拖”放节点操作。可以自己自定义创建,删除,嵌套,重命名,选择节点的规则。在这

8901

VASPKIT绘制平面平均电荷差分密度

平面平均密度差(planar-averaged electron density difference)是密度差的衍生。密度差是个三维空间函数,经常通过绘制平面图、等值面图方式图形化考察。虽然这两种图很直观,但平面图会受到截面选取的影响,而等值面图会受到等值面数值(isovalue)选取的影响,因此都有一定任意性,也不容易定量讨论。对于电子转移有比较明确方向的情况,可以绘制平面平均密度差曲线,由此可以清楚地考察垂直于选取的方向上每个截面上的密度差积分值,在定量讨论、对比上比较便利。

weixin_43948934的博客 1万+

matlab相机标定_实战 | 相机标定

点击“计算机视觉life”关注,置顶更快接收消息!本文阅读时间约5分钟什么是相机标定?我们为什么需要相机标定?相机标定就是确定相机内参和外参的过程,其结果精度会直接影响视觉系统后续工作的准确性。坐标系相机标定涉及到了四大坐标系,分别为:像素坐标系图像物理坐标系相机坐标系世界坐标系为了进行相机标定,必须已知世界坐标系中足够多的三维空间点坐标,找到这些空间点在图像中投影点的二维图像坐标,并建...

weixin_39747334的博客 771

给Dtree添加Checkbox

做 WEB 程序的人多数应该听说过 dtree,这个插件还不错,简单、效率还算可以,而且可以在cookie 中保存树的状态(刷新页面树会保持节点展开、收拢状态),如果节点量不是很大的情况下,是个不错的选择。但这个插件不带 checkbox。 dtree 的节点(Node)是个对象,所有节点保存在树(dTree)对象的一个属性里,重载了两个对象的 toString()函数,在页面显示的时候执行...

Luxika的专栏 310

激光除草技术原理与应用全解析

激光除草技术通过光热、光化学等效应精准破坏杂草组织,核心参数包括功率(20-6000W)、波长(400nm-10.6μm)和脉冲宽度。主要应用于大田作物(如玉米、棉花)、经济作物(烟草、果树)及城市绿化,具有环保(无化学污染)、高效(识别率≥95%)和非接触等优势,但存在设备成本高(20-50万元)、技术门槛高等局限。当前技术融合AI识别、多光谱协同等创新,国产设备如华工智耘已实现95.3%识别精度。虽短期投入较高,但长期可降低30%除草成本,并带来环境效益(每亩减排1.2吨CO₂)

start_up_go的博客 563

运用dtree组件动态生成带复选框的目录树

怎么获取数据库数据生成树,可以参考前面一节《运用dtree组件动态生成带复选框的目录树》,在这主要讲述怎么通过修改JS组件动态生成带复选框的目录树:1.给树对象的 config 对象添加一个控制 checkbox 是否显示的属性; this.config = { target : null, folderLinks : true,

kubete的专栏 9476

SAP RAP学习系列合集介绍

《SAP RAP学习系列合集:从入门到部署的完整指南》摘要: 本文介绍了作者创建的SAP RAP学习系列合集,涵盖RAP开发从基础概念到实战部署的全流程。系列目前包含17篇文章,系统讲解了RAP核心开发技术:从数据建模、UI构建到行为定义(包括并发控制、草稿功能、授权验证等),最后详细演示了应用部署到Fiori Launchpad的两种方案(OP版和ES版)。

DeveloperMrMeng的博客 1513

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

带checkBox的dtree

&lt;html&gt; &lt;head&gt; &lt;title&gt;Destroydrop &amp;raquo; Javascripts &amp;raquo; Tree&lt;/title&gt; &lt;link rel="StyleSheet" href="dtree.css" type="text/css" /&gt;

yangjiao0714的博客 189

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

带单选框、复选框的树形结构dtree

<br />1.给树对象的config对象添加一个控制checkbox是否显示的属性;<br />   this.config = {<br />        target                    : null,<br />        folderLinks            : true,<br />        useSelection        : true,<br />        useCookies            : true,<br />       

lzs109的专栏 6256

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

dTree树的checkbox 选中父节点,使其子节点都选中

注:topic.csdn.net/u/20071026/10/865b20c7-adde-49dc-bcf2-da7aaa6cd864.html 根据csdn朋友资料修改而来,略修改一下,更实用。 &lt;script type="text/javascript" &gt; dd = new dTree( 'dd '); dd.add(0,-1, '省市列表 ', ' '); d...

wangzi6hao的专栏 792
上一篇: jqueryAPI学习笔记
下一篇: 技术的学习和研究-以人类社会的需求为导向
hshhack
博客等级 码龄19年 58粉丝 39原创
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址