8 Replies Latest reply: May 29, 2012 3:37 AM by Bilal RSS

    af:tree is not displaying hierarchy in data

    Bilal
      Hi All,

      I am using Oracle Jdeveloper 11g R2.

      I created a view object based on SQL query which access pipelined packaged function as given below:
      SELECT * FROM TABLE(app_menu_mgmt_pack.tNavigationalMenus(:paraBindUserIdentifier, :paraBindMenuIdentifier))
      This query returns menu_id, menu_label, menu_base_id where menu_id is the parent attribute for menu_base_id.
      Then I created a viewlink that retrieves recursive data based on menu_id (source) and menu_base_id (target).

      I created af:tree in a page based on the view object and added rules for self recursion. When I run page, it is not displaying data in hierarchies.

      I am using pipeline functions in view, is it not possible to populate recursive tree (af:tree) as data is pipeline and not returned at once? Or I have to use some other properties to achieve this.

      Any help will be highly appreciated.
      Thanks in advance.

      Regards
      Bilal
        • 2. Re: af:tree is not displaying hierarchy in data
          Bilal
          Yes, I have gone through all the necessary steps to configure views, application module for recursive data from one view.

          The query returns values as given below:

          MenuID MenuLabel MenuBaseID
          5 G
          6 T 5

          At runtime af:tree only show the first row with value 5, when I disclose the node, it is not showing any child, which in this case is 6.

          The problem seems with passing bind variables to query. If I pass static values it is working fine. If I pass values through bind variables, then it is only displaying the first record of data and no children at all under the disclosed parent.

          Can someone please clarify the refresh of underlying view object. Is view object refreshes on every node disclose event? Or any help that help me resolve this issue.

          Thanks in advance
          Best Regards
          Bilal
          • 3. Re: af:tree is not displaying hierarchy in data
            Tulasi Kamodula
            Generally the tree table component will not use the detail instances added in the data model of the application module rather uses the view link accessor driven rowsets to show up children. So when you use static bind variables then it will automatically take the bind variables but when you set bind variables dynamically the view link accessor driven rowsets will not have the bind variables set which as a result will not display any child data. So try setting the bind params of the view link accessor for the current row parent row.

            Thanks,
            TK
            • 4. Re: af:tree is not displaying hierarchy in data
              Subramanian Meyyappan
              dear user,

              i hope this will helps you.

              http://mohammadjbyaseen.wordpress.com/2012/01/12/implement-herarichy-of-multiple-level-using-one-veiw-object/#comment-13
              this link is derived from the following discussions:
              ADF Tree with Self Join


              another one.
              See example 32 in the ADF Code Corner:
              http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html#CodeCornerSamples
              • 5. Re: af:tree is not displaying hierarchy in data
                Bilal
                I am passing userName from securityContext and menuBaseId from the Managed Bean to the above query. Can someone help me demonstrate/guide how to pass values from securityContext and Bean to view link accessor programatically.

                Edited by: Bilal on 22-May-2012 21:50
                • 6. Re: af:tree is not displaying hierarchy in data
                  Bilal
                  I have written following code in viewObjectImpl class to pass values of bind variables:
                  public void prepareRowSetForQuery(ViewRowSetImpl vrs) {
                    //Getting the parent row iterator
                    RowSetIterator[] parentRow = vrs.getMasterRowSetIterators();
                    //Setting the value of *paraBindUserIdentifier*
                    vrs.ensureVariableManager().setVariableValue("paraBindUserIdentifier", ADFContext.getCurrent().getSecurityContext().getUserName());
                  }
                  Now the problem is that is there any mechanism where I can access the value of bean from ViewObjectImpl class of view object for the following code:
                    vrs.ensureVariableManager().setVariableValue("paraBindMenuIdentifier", *CODE REQUIRED TO GET THE VALUE FROM BEAN DEFINED IN adfconfig*);
                  • 7. Re: af:tree is not displaying hierarchy in data
                    Tulasi Kamodula
                    You cannot access the beans from an VO impl class. Try having an rowDisclosureListener from that method try to access the current row and from the row the view link accessor rowset. Try with the following piece of code and see if it works.
                              JUCtrlHierNodeBinding node = (JUCtrlHierNodeBinding) treeTable.getRowData();
                                node.getChildIteratorBinding().getViewObject().setNamedWhereClauseParam("", "");
                                node.getChildIteratorBinding().executeQuery();
                    Note: It is highly not recommended to access the BC objects in the beans. It will break the MVC architecture in place. I am suggesting this as i did not have any other approach in mind as of now.

                    Thanks,
                    TK
                    • 8. Re: af:tree is not displaying hierarchy in data
                      Bilal
                      Hi Tulasi Kamodula

                      Your comments guided me in the right direction to dig in. I am done with the use case. I created a static variable in entity impl class and then created an application module client interface method to set its value whenever the tree node is disclosed and it is working fine.

                      Thanks again ... Best Regards
                      Bilal