Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8197401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:44:00+00:00 2026-06-07T05:44:00+00:00

How can I make jsTree hide non-matching elements, but still display the subnodes of

  • 0

How can I make jsTree hide non-matching elements, but still display the subnodes of matched elements?

As far as I know there are only two possibilities, that are both not suited for this case. You can either make jsTree hide no element at all by setting

show_only_matches: false

Or you can make it hide all non-matched elements by setting

 show_only_matches: true

But this option also hides the subnodes of matched nodes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:44:01+00:00Added an answer on June 7, 2026 at 5:44 am

    Finally, I found the solution, though it doesn’t look really nice, but it works.
    Just pass a the found elements the the enableSubtree()-function, and it will show the nodes and take care of the correct appearance (i.e. that the dotted lines are shown and hidden correctly).

    enableSubtree = function(elem) {
      elem.siblings("ul:first").find("li").show();
      return correctNode(elem.siblings("ul:first"));
    };
    
    correctNode = function(elem) {
      var child, children, last, _j, _len1, _results;
      last = elem.children("li").eq(-1);
      last.addClass("jstree-last");
      children = elem.children("li");
      console.log(children);
      _results = [];
      for (_j = 0, _len1 = children.length; _j < _len1; _j++) {
        child = children[_j];
        _results.push(correctNode($(child).children("ul:first")));
      }
      return _results;
    };
    

    A call of this function could look like this:

    enableSubtree($(".jstree-search"))
    

    since all found nodes receive the CSS class .jstree-search.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i know there is a plugin for jsTree named jquery.tree.checkbox.js. that make the tree
I can make query to get the Master -Chile records. But how to display
I can make a single row IKImageBrowserView by setting the [imageBrowser setContentResizingMask:NSViewWidthSizable]; but in
Anyone know how I can make a login button in Ruby on Rails for
I can make smtplib send to other email addresses, but for some reason it
I can make a new , and that seems to work. But edit/update does
I can make get or post request using urllib, but how do I make
I know I can make a new variable by simply saying $var = stuff
How i can make in this JS to display only once same class? In
I know how I can make it so that hitting doesn't insert a tab,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.