0

I have a problem with my project in Angular. Let's say I have a tree component with the below sample nodes.

nodes =[
    {
        "id": "101",
        "name": "Tree1",
        "children": [
            {
                "id": "55",
                "name": "Child Tree1",
                "children": [
                    {
                        "id": "65",
                        "name": "Grand Child 1",
                        "children": [
                            {
                                "id": "151",
                                "name": "10.8.233.45"
                            },
                            {
                                "id": "160",
                                "name": "62.238.180.70"
                            }
                        ],
                        "type": "typegrandchild"
                    }
                ],
                "type": "typechild"
            }
        ],
        "type": "typeparent"
    },

And I have a search filed where it will allow user to search with the IP address. But I have tried with treeComponent.treeModel.filterNodes(filter). It is showing only the root one in the above case Tree1.

But I want to show all the root nodes along with IP like Tree1-->Child Tree1---> Grand Child 1---> 10.8.233.45

seenukarthi
  • 8,241
  • 10
  • 47
  • 68
  • you should call to `this.treeControl.expandAll();`, see the last answer to this [SO](https://stackoverflow.com/questions/73153372/how-can-i-filter-options-based-on-search-text-in-angular) – Eliseo Apr 13 '23 at 13:06

0 Answers0