zoukankan      html  css  js  c++  java
  • EasyUI combotree 使用技巧

    转载出处 :http://www.cnblogs.com/wangjunwei/p/4932366.html

    复制代码
    $('#areaName').combotree({
                url: '../Ajax/Common.ashx?Method=GetCombotreeData',
                multiple: true,
                checkbox: true,
                isShowPic: false,
                onCheck: function (node, checked) {
                    //   MainJs.RemoveNodeAll('areaName');
                },
                onLoadSuccess: function (node, data) {
                    var rootNode = data[0];//第一个节点
                    if (rootNode) {
                        var t = $('#areaName').combotree('tree'); // 获取树对象
                        var node1=t.tree('find', rootNode.id);
                        t.tree("uncheck", node1.target); //取消所有的选中
                    }
                }
            });
    复制代码

    默认选中根节点的方法

    复制代码
     onLoadSuccess: function (node, data) {
                    var t = $('#WAY_JY').combotree('tree'); // 获取树对象
                    var rootNode = t.tree('getRoot');//基础节点
                    //var node1 = t.tree('find', rootNode.id);
                    t.tree("uncheck", rootNode.target); //取消所有的选中
                }
    复制代码

     json格式

    复制代码
    [
      {
        "id": 1,
        "text": "My Documents",
        "children": [
          {
            "id": 11,
            "text": "Photos",
            "state": "closed",
            "children": [
              {
                "id": 111,
                "text": "Friend"
              },
              {
                "id": 112,
                "text": "Wife"
              },
              {
                "id": 113,
                "text": "Company"
              }
            ]
          },
          {
            "id": 12,
            "text": "Program Files",
            "children": [
              {
                "id": 121,
                "text": "Intel"
              },
              {
                "id": 122,
                "text": "Java",
                "attributes": {
                  "p1": "Custom Attribute1",
                  "p2": "Custom Attribute2"
                }
              },
              {
                "id": 123,
                "text": "Microsoft Office"
              },
              {
                "id": 124,
                "text": "Games",
                "checked": true
              }
            ]
          },
          {
            "id": 13,
            "text": "index.html"
          },
          {
            "id": 14,
            "text": "about.html"
          },
          {
            "id": 15,
            "text": "welcome.html"
          }
        ]
      }
    ]
    复制代码

     清空控件的值:

    $("#type").combotree('clear');//清空控件的值

    ---->

  • 相关阅读:
    lucene1.0.1写入分析
    esm数据迁移
    datadog入门
    elasticsearch datehistogram聚合
    cookie实战
    泛型编程
    lucene分析
    2020年12月阅读文章
    迭代
    lucene搜索
  • 原文地址:https://www.cnblogs.com/Thinkingcao/p/7339329.html
Copyright © 2011-2022 走看看