开发者

Check jstree search result

开发者 https://www.devze.com 2023-04-11 02:18 出处:网络
Can I check if jsTree serach yields some results? for example, can I do something like that: var searchResult = $(\'#m开发者_如何学CyTree\').jstree(\'search\', \'keyword\');

Can I check if jsTree serach yields some results?

for example, can I do something like that:

var searchResult = $('#m开发者_如何学CyTree').jstree('search', 'keyword');
if(searchResult.haveResults){
   Do something...
};


Finally I found some solution:

var searchResult = $('#myTree').jstree('search', 'keyword');
if ($(searchResult).find('.jstree-search').length == 0) {
   //Do something...
};

.jstree-search is the css class which stick to results nodes.

0

精彩评论

暂无评论...
验证码 换一张
取 消