Angular tree view Component Filter

107 Views Asked by At

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

0

There are 0 best solutions below