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 閱讀(1654) 評論(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= "財務(wù)部" id= "1"></item>
          <item? open="1" child="0"? text= "技術(shù)部" 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屬性表示是否有子級
          主站蜘蛛池模板: 韶关市| 丘北县| 禹州市| 宁德市| 临邑县| 镇巴县| 塔城市| 霍邱县| 息烽县| 洛隆县| 临邑县| 兴安县| 伊吾县| 东阿县| 内黄县| 柳州市| 红河县| 千阳县| 浮山县| 巴彦县| 南昌县| 新野县| 泰州市| 静海县| 高清| 武功县| 泰安市| 乾安县| 望都县| 临潭县| 曲水县| 屯昌县| 庆安县| 和林格尔县| 太保市| 新津县| 四平市| 万载县| 鄯善县| 霍州市| 东丰县|