Refreshing Child Nodes of an af:treeTable / af:tree in Oracle ADF

Sharing is Caring

Hello All,
A very common problem in af:treeTable and af:tree is to refresh child nodes after any DML operation on the tree.
To avoid this refresh problem developer can pragmatically refresh treeTable’s child node.

  • First get the master ViewObject on that treeTable is based
  • if viewObject has any key attribute then filter it against a key for that you want to refresh child nodes
  • if viewObject doesn’t have any key attribute, then filter it using any unique key to get header(master) row
  • get the row set of child rows for that key, using view link accessor
  • execute the query for Child Rows row set
  • see the refreshed child node 🙂

Refresh af:treeTable Using Key Attribute

// Get Master ViewObject
    ViewObjectImpl viewObj = masterViewObject;  
    // Filter It Using Key Attribute
  Row[] grpRow = vo.findByKey(new Key(new Object[] { keyAttribute Value }), 1);  
       // Get Child Rows using ViewLink Accessor
        if(grpRow.length>0){
        RowSet childRows = (RowSet)grpRow[0].getAttribute("viewLink AccessorName");  
  //Execute Child Rowset
        childRows.executeQuery();  
        }

 

Using Unique Key

      // Get Master ViewObject
    ViewObjectImpl viewObj = masterViewObject;  
    // Filter It Using Key Attribute
   Row[] grpRow=viewObj.getFilteredRows("uniqueKey", uniqueKey Value); 
       // Get Child Rows using ViewLink Accessor
        if(grpRow.length>0){
        RowSet childRows = (RowSet)grpRow[0].getAttribute("viewLink AccessorName");  
  //Execute Child Rowset
        childRows.executeQuery();  
        }

Some more blogs on the tree table
Programmatically refreshing the child nodes of an <af:tree>
Tree Table Component in Oracle ADF(Hierarchical Representation)
Implementing master/detail tree relation using af:Iterator and af:forEach for better UI designs – Oracle ADF 
Tree Table Component with declarative presentation in ADF, Access childs without custom selection listener
CRUD operations on a tree table
Tree Table Component in Oracle ADF

Cheers 🙂 Happy Learning

Related Posts

I’m an Oracle ACE, Blogger, Reviewer,
Technical Lead working on Oracle ADF

0 thoughts on “Refreshing Child Nodes of an af:treeTable / af:tree in Oracle ADF”

Leave a Reply

Your email address will not be published. Required fields are marked *