搜索后的jstree键盘导航,"show_only_matches"为true

HAD*_*DEV 8 javascript jquery jstree

我正在尝试使用jstree键盘导航与搜索插件.一切都还可以但是在我将show_only_matches添加为true之后导航没有按预期工作.也许是因为有隐藏的节点,jstree尝试浏览它们.

这是我的jsfiddle

http://jsfiddle.net/53cvtbv9/1/

$(function() {

    $(".search-input").keyup(function() {

        var searchString = $(this).val();
        console.log(searchString);
        $('#jstree').jstree('search', searchString);
    });


    $('#jstree').jstree({
        'core': {

            'data': [ ... ]



        },
        "search": {

            "case_insensitive": true,
            "show_only_matches" : true


        },

        "plugins": ["search"]


    });
});
Run Code Online (Sandbox Code Playgroud)

任何解决方案都是......

小智 12

$("#nacetree").jstree({
        "core" : {'data' : nace} ,
        "plugins" : [ "search" ] ,
        "search": { "show_only_matches" : true}
    });
    var to = false;
    $("#qnace").keyup(function () {
        //if(to) { clearTimeout(to); }
        to = setTimeout(function () {
            var v = $('#qnace').val();
            $('#nacetree').jstree(true).search(v);
        }, 250);
    }); 
Run Code Online (Sandbox Code Playgroud)