自定义搜索jQuery FancyTree插件 [英] Custom search for jQuery FancyTree plugin

查看:227
本文介绍了自定义搜索jQuery FancyTree插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目中使用了FancyTree jQuery插件: https://github.com/mar10/fancytree

I'm using the FancyTree jQuery plugin in one of my projects: https://github.com/mar10/fancytree

此插件还具有Filter扩展名,该扩展名可以调暗或隐藏不匹配的节点: https://github.com/mar10 /fancytree/wiki/ExtFilter

This plugin also has a Filter extension which either dimms or hides the unmatched nodes: https://github.com/mar10/fancytree/wiki/ExtFilter

我的树是两级树,这意味着其中有一些带有子级的文件夹.我想做的是-同时按文件夹名称和节点名称进行搜索.问题是当您遇到类似这样的情况时:

My tree is a two-level tree, it means that there are folders which have children. What I try to do is - search by both Folder name and nodes names. The problem is that when you have something like this:

节点标题 -节点子 -节点子节点2

Node Title - Node child - Node child 2

按标题"进行搜索将保留文件夹节点标题",并隐藏子项,因为其中没有标题".

Searching by "Title" will leave the folder "Node Title" and hide the children since there's no "Title" in them.

我要做的是-同时搜索文件夹名称和子名称,但不隐藏子名称-仅隐藏不匹配的文件夹.

What I want to do is - search by both folder name and children names but don't hide the children - hide the unmatched folders only.

因此,当您通过标题"进行搜索时-它会隐藏所有不包含标题"的文件夹,但完整保留节点标题"文件夹的子节点-可见.

So, when you search by "Title" - it will hide all the folders which do not have "Title" in them but leave the child nodes of "Node Title" folder intact - visible.

有人可以帮助我提供有关如何完成此操作的建议吗?

Could anybody help me with an advise on how can this be done?

预先感谢!

推荐答案

此新功能刚刚实现: https://github.com/mar10/fancytree/wiki/ExtFilter

This new feature has just been implemented: https://github.com/mar10/fancytree/wiki/ExtFilter

寻找tree.filterBranches(filter)方法.

这篇关于自定义搜索jQuery FancyTree插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆