【问题标题】:js tree is not working in ie when handle check/uncheck event and set all check box true togetherjs树在处理选中/取消选中事件并将所有复选框设置为true时不起作用
【发布时间】:2019-08-22 10:05:55
【问题描述】:

我正在使用 jstree 来绑定数据。我已经检查(选择)所有复选框,并调用复选框的检查/取消选中事件。它在 Chrome 中工作正常,但在 IE 中我可以处理选中/取消选中事件,但默认情况下它没有选中(选择)所有复选框。

请查看以下代码:

$('#filterResult').jstree({
        "core": {
            "data": data,
            "themes": {
                "icons": false
            },
            check_callback: false
        },
        'checkbox': {
            three_state: true,
            cascade: 'none',
            whole_node: false, 
            tie_selection: false, // when remove this then all checkbox are selected by dafualt but check/uncheck event is not working
            real_checkboxes: true
        },
        "plugins": [
            "wholerow",
            "checkbox"
        ]
    })
        .on('loaded.jstree', function () {
            $("#filterResult").jstree().check_all(true);
           // $("#filterResult").jstree("select_all");               
        })
        .on("check_node.jstree uncheck_node.jstree", function (e, data) {

          console.log(data.node.id);
            }
        });

当我从 'checkbox' 中删除 tie_selection: false 然后选择 IE 中的所有复选框都可以正常工作,但随后复选框选中/取消选中事件不起作用。

以上代码在 Chrome 中运行。

【问题讨论】:

    标签: javascript jquery jstree jstree-dnd


    【解决方案1】:

    由于某种原因,loaded.jstree 事件没有在 IE 上触发(尝试设置断点,不起作用)。

    为此,您可以尝试将其替换为 ready.jstree

    这里是pen的代码。

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 2011-01-24
      • 2015-11-27
      • 1970-01-01
      • 2013-05-26
      • 1970-01-01
      • 1970-01-01
      • 2014-08-22
      • 2016-03-16
      • 1970-01-01
      相关资源
      最近更新 更多