Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jstree keyboard navigation after search with "show_only_matches" as true

I am trying to use jstree keyboard navigation with search plugin . Everything is ok but after I add show_only_matches as true the navigation didn't work as expected . Maybe because there are hidden nodes and jstree try to navigate through them ..

Here is my 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"]


    });
});

Any solution plz ...

like image 512
HADEV Avatar asked Sep 03 '14 18:09

HADEV


1 Answers

$("#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);
    }); 
like image 65
seb Avatar answered Oct 27 '22 22:10

seb