iVantage / angular-ivh-treeview

A treeview for AngularJS with filtering and checkbox support.
http://ivantage.github.io/angular-ivh-treeview/
MIT License
238 stars 89 forks source link

Filtered items #187

Closed AnatolyPruchay closed 7 years ago

AnatolyPruchay commented 7 years ago

Greetings! Is it possible to filter this way When in the filtered list only the parent To show children, if you expand the list? In the current version only the parent is displayed.

AnatolyPruchay commented 7 years ago

You can see the issue at http://jsbin.com/jijoma/3/edit?html,js,output Try filter by whiskey and there is no childrens when it expand

jtrussell commented 7 years ago

Yes, we're using Angular's filterFilter which by default will recursively check child properties. This is why a parent will remain visible when your search matches a child but the child is hidden when your search matches a parent. You have at least a couple options:

  1. Include ancestor names in (perhaps unused) properties of child nodes so these are also matched by searches that match the parent.
  2. Provide a function to use for filtering (instead of a string) that will match a child node if one of it's ancestor nodes is matched.
AnatolyPruchay commented 7 years ago

Thsnks! but i already solved this issue by the filter function that control show/hide property on nodes)