Looking for jsTree AJAX with some node children?

I am trying to implement ajax search in jsTree, but only inside one of the root node.

I read the docs and found some information about:

$ .jstree.defaults.search.ajax

The str parameter (which is the search string) will be added with the request, an additional internal parameter will be added if the search is limited by the node identifier.

My SEARCH AJAX config:

        "search": {
        // search config
        "show_only_matches": true,
          'ajax': {
            'url': "/ajax/root-nodes"
          }
        },

jsSearch call:

$tree.jstree(true).search(searchText);

I also use lazy subnode loading.

Does anyone do something like this?

+4
source share
1 answer

In your conversation, you do not limit the search to a specific node:
http://www.jstree.com/api/#/?q=search%28&f=search%28str%20[,%20skip_async†%29

, , root node ID - "root1", :
$tree.jstree(true).search(searchText, false, true, 'root1');

search , AJAX . , "foo" - GET - str inside:
GET /ajax/root-nodes?str=foo&inside=root1

JSON, , ( ). , , , , ( ):
["root1","somenode"]

+3

Source: https://habr.com/ru/post/1599811/


All Articles