Fix sidebar search to force-include virtual nodes (#14)
This commit is contained in:
parent
6532bd7dc1
commit
d3af6611c6
@ -93,11 +93,19 @@ export class AppComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFilterChange($event) {
|
onFilterChange($event) {
|
||||||
const value = $event.detail.value.toLowerCase();
|
const query = $event.detail.value.toLowerCase();
|
||||||
|
this.menuTree.treeModel.clearFilter();
|
||||||
|
if ( query ) {
|
||||||
this.menuTree.treeModel.filterNodes(node => {
|
this.menuTree.treeModel.filterNodes(node => {
|
||||||
return node.data.name.toLowerCase().includes(value);
|
if ( node.data.virtual ) {
|
||||||
|
// "Virtual" tree nodes should always be shown
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return node.data.name.toLowerCase().indexOf(query) >= 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async onNodeMenuClick($event) {
|
async onNodeMenuClick($event) {
|
||||||
console.log(this.menuTarget)
|
console.log(this.menuTarget)
|
||||||
|
Loading…
Reference in New Issue
Block a user