ADF: Filtering parent and child nodes in af:tree / af:treeTable
One of our customers required to filter data in a page with a tree component. Using Ashish’s post I am going to show you how to filter both parent and child nodes having just a single filter value. This can also be applied to treeTable component.
The first thing we need is a tree component and data structure, in this case we are going to use Oracle’s hr schema tables: Departments and Employees.
In our page we drag and drop DepartmentsView from datacontrols palette and create a tree component.
The next thing we have to do is to create a View Criteria in Departments View Object (parent).
The last step in the Model is to set a default View Criteria in parent View Object. To set it we have to right click on the View Object instance in our AppModule, click on ‘Edit’, select the View Criteria and click on ‘Ok’ button.
This is how we should have the page.
If we run the application we can see the if we filter by ‘pat’ we just get values that contains that string.
If now we filter by ‘les’, we can see that we get values with ‘les’ string in both parent and child nodes.
7 Comments
Sanjeev Chauhan
January 25, 2016
Hi Ruben, Thank you for your post. I also tried to achieve similar things but in a different approach
http://sanjeev-technology.blogspot.in/2014/07/adf-tree-searching-child-nodes-using.html
Idea was to retain search panel so that we can still use save/basic/advance/reset etc feature of search panel. Yes, I was not aware of createViewLinkAccessorRS that time.
Tarek Fathy
January 30, 2016
thank you so much
Unknown
May 7, 2016
Hello, I want to know if it is possible to use this approche in tree table based on just one viewObject (and view link "parentId" ==> "childId") ?
Ruben Rodriguez
May 7, 2016
Hello, I haven't tried but it should be possible to to it on a recursive View Object.
regards,
Ruben.
salah ayman
June 23, 2016
Does it work with you Naser i try recursive tree but it doesn't work with me
Unknown
June 23, 2016
Neither I.
Unknown
January 15, 2019
Link not accessible