【问题标题】:Generate Treeview in jquery在 jquery 中生成树视图
【发布时间】:2016-04-04 08:32:29
【问题描述】:

我想使用 jstree 生成树视图。在此树视图中,用户可以选择更改树视图的结构,例如添加父视图、添加子视图、重命名节点等。它必须是可展开、可折叠并带有复选框。

看起来像这样: sample Image

搜索了很多,但没有找到。唯一的出路就是在这里提问。

【问题讨论】:

    标签: jquery treeview iteration jstree


    【解决方案1】:

    试试下面的代码...

    $('#jstree_demo').jstree({
      "core" : {
        "animation" : 0,
        "check_callback" : true,
        "themes" : { "stripes" : true },
        'data' : {
          'url' : function (node) {
            return node.id === '#' ?
              'ajax_demo_roots.json' : 'ajax_demo_children.json';
          },
          'data' : function (node) {
            return { 'id' : node.id };
          }
        }
      },
      "types" : {
        "#" : {
          "max_children" : 1,
          "max_depth" : 4,
          "valid_children" : ["root"]
        },
        "root" : {
          "icon" : "/static/3.3.0/assets/images/tree_icon.png",
          "valid_children" : ["default"]
        },
        "default" : {
          "valid_children" : ["default","file"]
        },
        "file" : {
          "icon" : "glyphicon glyphicon-file",
          "valid_children" : []
        }
      },
      "plugins" : [
        "contextmenu", "dnd", "search",
        "state", "types", "wholerow"
      ]
    });
    

    更多详情可以查看here

    希望这会有所帮助....

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多