Jstree clear search does but keep nodes open

Viewed 12

I initially had a simple jstree where all data was loaded at initialization.

$("#tree").jstree().search(searchString)

and

$("#tree").jstree("clear_search")

was working perfectly fine.

Now I have larger tree with lazy loading. My tree configuration is as follows

{
  "core": {
    "check_callback": true,
    "loaded_state": true,
    "data": {
      "url": "http://x.x.x.x:9000/yang/loadOneLevel",
      "dataType": "json"
    },
    "worker": false
  },
  "plugins": [
    "massload",
    "search",
    "state"
  ],
  "massload": {
    "method": "post",
    "url": "http://x.x.x.x:9000/yang/massLoadTree",
    "dataType": "json"
  },
  "search": {
    "ajax": {
      "url": "http://x.x.x.x:9000/yang/searchTree",
      "dataType": "json"
    }
  }
}

Now I perform search and clear as follows

$("#tree").jstree('search', searchString, false, false,[],false);
$("#tree").jstree("clear_search");

The search results are showing up fine. However, on clearing search, the nodes which opened to show search results close off.

Is there a way to keep all nodes open and just remove the css added for search matches?

0 Answers
Related