MDA/MDD/TDD/DDD/DDDDDDD
          posts - 536, comments - 111, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          dhtmlxtree筆記

          Posted on 2009-01-15 23:58 leekiang 閱讀(1651) 評論(0)  編輯  收藏 所屬分類: web開發(fā)
          1,基本寫法
          <body>
          ??? <link rel="STYLESHEET" type="text/css" href="css/dhtmlxtree.css">
          ??? <script? src="js/dhtmlxcommon.js"></script>
          ??? <script? src="js/dhtmlxtree.js"></script>
          ??? <div id="treeboxbox_tree"></div>
          ??? <script type="text/javascript">
          ??tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
          ??tree.attachEvent("onClick",onNodeSelect);
          ??tree.setImagePath("images/tree/");
          ??tree.setXMLAutoLoading("dept.do?action=folder_treeview");//逐級展開
          ??tree.loadXML("dept.do?action=folder_treeview&id=1");//初始化
          ??function onNodeSelect(nodeId){
          ????? document.getElementById("parent_folder_id").value = nodeId;
          ??}
          ??? </script>
          </body>


          2,初始化需要的xml,必須帶item
          <?xml version='1.0' encoding='utf-8'?>
          <tree id="0">
          <item nocheckbox="1" open="1" id="-1" select="0" text= "公司" >
          <item? open="1" child="1"? text= "財務部" id= "1"></item>
          <item? open="1" child="0"? text= "技術部" id= "2"></item>
          <item? open="1" child="0"? text= "人事部" id= "4"></item>
          </item>
          </tree>
          注意<tree>里的id的值必須和dhtmlXTreeObject的第4個參數(shù)的值保持一致,否則會報錯:
          Error type: DataStructure
          Description: XMLrefferstonotexistingparent

          3,逐級展開的xml
          <?xml version="1.0" encoding="utf-8"?><tree id="3">
          <item? open="1" text= "甲部門" id= "5" ></item>
          <item? open="1" text= "乙部門" id= "6" ></item>
          </tree>

          4,child屬性表示是否有子級
          主站蜘蛛池模板: 克什克腾旗| 定南县| 竹北市| 府谷县| 新巴尔虎右旗| 盱眙县| 双柏县| 黎城县| 黄石市| 隆德县| 甘孜| 高平市| 民和| 怀仁县| 和硕县| 鄂尔多斯市| 珠海市| 乃东县| 莱芜市| 建德市| 巴林左旗| 锦州市| 长子县| 丰宁| 墨脱县| 蕉岭县| 东乌珠穆沁旗| 前郭尔| 广德县| 北辰区| 栖霞市| 崇信县| 江西省| 嘉黎县| 清水河县| 云和县| 沂南县| 桂平市| 安宁市| 桐梓县| 贵定县|