1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關咨詢
      選擇下列產品馬上在線溝通
      服務時間:8:30-17:00
      你可能遇到了下面的問題
      關閉右側工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      jquery ztree的一些簡單操作

      一、顯示ztree 的節(jié)點

      成都創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設、高性價比明水網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式明水網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設找我們,業(yè)務覆蓋明水地區(qū)。費用合理售后完善,十載實體公司更值得信賴。

      1,前臺轉換顯示 :

        通過jquery ajax 獲得節(jié)點集合: nodelist

        將數(shù)據(jù)轉換成指定格式:

        var treeNodes = [];

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

        treeNodes.push({id:nodelist[i].bm, parentId:nodelist[i].sjbm, name:nodelist[i].mc,open: ((nodelist[i].sjbm=='0000000') ? true : false),

        tag:result[i]});

        }

        $.fn.zTree.init($("#tree"),selectionSetting, treeNodes);(selectionSetting 的定義省略)

        2,后臺轉換顯示:

        代碼:

        /**

        * 將科目數(shù)據(jù)轉化成json格式的數(shù)據(jù)用于樹控件

        */

        public String getsubjectAll() {

        JSONArray jsonArr = new JSONArray();

        try {

        List subjects = subjectDao.getSubjectAll();

        for (HdzxKm subject : subjects) {

        JSONObject json = new JSONObject();

        json.put("id", subject.getBm());

        json.put("name", subject.getMc());

        if(如果是父級){

        json.put("open", false);

        json.put("parentId", subject.getSjbm());

        jsonArr.add(json);

        }

        } catch (Exception e) {

        e.printStackTrace();

        }

        return jsonArr.toString();

        }

        前臺獲得該方法返回的數(shù)據(jù),就不用轉換直接:

        $.fn.zTree.init($("#tree"),selectionSetting, treeNodes);(selectionSetting 的定義省略)

        treeNodes 為后臺返回的數(shù)據(jù)

        二、根據(jù)節(jié)點的id選中指定節(jié)點

        var treeObj = $.fn.zTree.getZTreeObj("tree");

        treeObj.selectNode(treeObj.getNodeByParam("id","000000000000", null));(000000000000:節(jié)點Id的值)

        三、自定義修改節(jié)點的名稱(根據(jù)節(jié)點id值)

        var treeObj = $.fn.zTree.getZTreeObj("tree");

        var node = treeObj.getNodeByParam("id", id的值, null);

        node.name="xxxxx";

        treeObj.updateNode(node,true);(此處為更新節(jié)點值,此步不能省)

        四、新增節(jié)點

        var treeObj = $.fn.zTree.getZTreeObj("tree");

        var node = treeObj.getNodeByParam("id", xxx, null);

        treeObj.addNodes(node, {id :xxx,parentId :xxx,name : xxx});

        五、有復選框是,選中指定節(jié)點

        var zTree =$.fn.zTree.getZTreeObj("tree");

        var node=zTree.getNodeByParam("id",id值, null);

        zTree.checkNode(node);


        網(wǎng)站標題:jquery ztree的一些簡單操作
        文章鏈接:http://www.ef60e0e.cn/article/jhieoo.html
        99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
        1. <ul id="0c1fb"></ul>

          <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
          <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

          贵溪市| 中卫市| 乐山市| 巴林左旗| 会泽县| 泸州市| 玉树县| 安岳县| 丽江市| 大冶市| 望江县| 江城| 新密市| 任丘市| 宣恩县| 庆元县| 克拉玛依市| 太谷县| 河间市| 青冈县| 崇州市| 策勒县| 梁河县| 黄冈市| 定西市| 繁峙县| 中宁县| 张家川| 乐至县| 铜梁县| 横峰县| 镇平县| 中超| 林芝县| 化隆| 呈贡县| 新晃| 儋州市| 咸阳市| 濮阳县| 太湖县|