【问题标题】:jstree incompatible checkbox and types pluginjstree 不兼容的复选框和类型插件
【发布时间】:2015-11-25 11:01:02
【问题描述】:

我正在使用 jstree javascript 库创建一棵树,同时使用两个 jstree 插件:

  • 复选框插件

  • 类型插件

这是一个代码示例

var mydata=[
id: "1",
parent: "#",
text: "node1",
},
{
id: "2",
parent: "#",
text: "node2",
type: "nodeattribute",
}];

        $('#dqResultsJSTree').jstree(
                {
                    'core' : {
                        'themes' : {
                            'variant' : 'large',
                            'icons' : false,
                        },
                        'data' : mydata,
                    },
                    'types' : {
                            'nodeattribute' : {
                              'icon' : 'http://icons.iconarchive.com/icons/hydrattz/multipurpose-alphabet/24/Letter-A-lg-icon.png',
                            },
                     },
                    'checkbox' : {
                        cascade : "",
                        three_state : false,
                    },
                    'plugins' : [ 'checkbox', 'types'],
                });

我遇到的问题是该类型不起作用。 id=2 的节点不显示在类型 nodeattribute 中定义的图标。有人在同时使用复选框时遇到过这个问题吗?

提前致谢。

来源:https://www.jstree.com/plugins/

【问题讨论】:

    标签: javascript jquery checkbox jstree


    【解决方案1】:

    您必须在 jsTree 配置的 core 部分中设置 'icons': true

    我还修复了您的 JSON - 需要 { 用于 mydata 中的第一个对象。

    查看演示:JS Fiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-16
      • 1970-01-01
      • 2014-07-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多