---用来测试的 select permission_id,permission_name,count(permission_id) from permission where1=1and parent_id isnullgroupby permission_id,permission_name
然后呢,就是修改后的dtree脚本了,这里只放修改后的部分。。。
// Add by xiaosilent . // get child nodes from web server via AJAX automatically // pid : parentID. dTree.prototype.getChildren =function(pid)...{ var ajax =null; if (window.ActiveXObject) ...{ try...{ ajax =new ActiveXObject("Microsoft.XMLHTTP"); }catch(e)...{ alert("å建Microsoft.XMLHTTP对象失败,AJAXä¸è½æ£å¸¸è¿è¡.è¯·æ£æ¥æ¨çæµè§å¨è®¾ç½®."); } }else...{ if (window.XMLHttpRequest) ...{ try...{ ajax =new XMLHttpRequest(); }catch(e)...{ alert("å建XMLHttpRequest对象失败,AJAXä¸è½æ£å¸¸è¿è¡.è¯·æ£æ¥æ¨çæµè§å¨è®¾ç½®."); } } } // following is just for xiaosilent's Sales Management System. // Server gives me a message like this : id1,name1,childCount1|id2,name2,childCount2|... // var url ="/servlet/category?action=getChildren&parentID=" + pid +"&type=" + this.type; var url="treeServlet?parentId="+pid; // use this to get this dTree object in the following function. var tree=this; ajax.onreadystatechange =function () ...{ if (ajax.readyState ==4&&ajax.status ==200) ...{ if(ajax.responseText=="false") ...{ return; } var categories=ajax.responseText.split('|'); for(var i=0;i<categories.length;i++)...{ var aCat = categories[i].split(','); if(aCat.length==3)...{ var id=aCat[0]; var name=aCat[1]; var childCount=aCat[2]; // set different icon for a node, if it has a child set its icon to be a folder image , else default , set to be a file image. And set different link address. if(childCount>0)...{ tree.add(id, pid, name, "javascript:"+tree.obj+".getChildren("+id+")", "ç¹å»è·åå ¶åç±»",'',tree.icon.folder); }else...{ tree.add(id, pid, name, "javascript:"+tree.obj+".showCategory("+id+")", "ç¹å»è·å详请"); } } } tree.show(); tree.openTo(pid); } }; ajax.open("POST",url); ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); ajax.send(null); } dTree.prototype.showCategory =function()...{ } // Add by xiaosilent. // Call to show the tree . dTree.prototype.show =function()...{ // Renew the two array to save original data. this.aNodes=new Array(); this.aIndent=new Array(); // Dump original data to aNode array. for(var i=0 ; i<this.aNodesData.length ; i++)...{ var oneNode=this.aNodesData[i]; this.aNodes[i]=new Node(oneNode.id,oneNode.pid,oneNode.name,oneNode.url,oneNode.title,oneNode.target,oneNode.icon,oneNode.iconOpen,oneNode.open); } this.rewriteHTML(); }