I have a dropdown in UI side and list of the objects. In this list there are lots of child objects and I need to filter all of those children. Please check below object. I am trying to do by Node JS.
[
{
name : "This is horse",
id:1
parentId : null
},
{
name : "horse child",
id:2
parentId : 1
},
{
name : "horse child child",
id:3
parentId : 2
},
{
name : "QQQQQ",
id:4
parentId : 1
},
{
name : "WWWWWWWWWW",
id:5
parentId : 3
},
{
name : "WWWWWWWWWW",
id:6
parentId : null
}
]
If I select Level 0 then I get id: 1,6
If I select Level 1 then I get id: 1,2,4,6
If I select Level 2 then I get id: 1,2,3,4,5,6