I'm using the FancyTree jQuery plugin in one of my projects: https://github.com/mar10/fancytree
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:
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?
Thanks beforehand!
This new feature has just been implemented: https://github.com/mar10/fancytree/wiki/ExtFilter
Look for the tree.filterBranches(filter)
method.
I had exactly the same problem and google brought me here. It took me some time to understand this answer. You have to replace the filterNodes(...) in the sample with filterBranches(...). The internal function can stay exactly the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With