Fix sidebar search to force-include virtual nodes (#14)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Garrett Mills 2020-10-12 13:48:41 -05:00
parent 6532bd7dc1
commit d3af6611c6
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -93,10 +93,18 @@ export class AppComponent implements OnInit {
}
onFilterChange($event) {
const value = $event.detail.value.toLowerCase();
this.menuTree.treeModel.filterNodes(node => {
return node.data.name.toLowerCase().includes(value);
});
const query = $event.detail.value.toLowerCase();
this.menuTree.treeModel.clearFilter();
if ( query ) {
this.menuTree.treeModel.filterNodes(node => {
if ( node.data.virtual ) {
// "Virtual" tree nodes should always be shown
return true;
}
return node.data.name.toLowerCase().indexOf(query) >= 0;
});
}
}
async onNodeMenuClick($event) {