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

    $('#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');//清空控件的值

    ---->

  • 相关阅读:
    密文搜索
    poj 1182 食物链
    1147. Heaps (30)
    1146. Topological Order (25)
    1145. Hashing
    1142. Maximal Clique (25)
    fzu 2112 tickets
    51nod 1554 欧姆诺姆和项链
    codeforces 963B Destruction of a Tree
    hdu 3294 Girls' research
  • 原文地址:https://www.cnblogs.com/wangjunwei/p/4932366.html
Copyright © 2011-2022 走看看