This discussion is archived
8 Replies Latest reply: Feb 11, 2013 12:01 AM by Raguraman RSS

How to access Parent page UIComponent from inlineFrame using ADF javascript

Raguraman Explorer
Currently Being Moderated
Hi,

My application includes an <af:inlineFrame component on the top portion of the page. It contains a table with delete option for the end user. Requirement is after user has deleted all the records of the table and table has no records to display, inlineFrame needs to be made invisible so that the bottom portion content of my page will get stretched fully and has more visibility to the user. Hence when user click on Delete button of the table, after delete operation, I am planning to check the row count and write javascript to client using ExtendedRenderKitService to make the inlineframe invisible.

Question:

1. What is the right ADF javascript API to access the parent page and work with its components. I came to know we can call using 'parent.document.getElementById' but I want to know correct ADF's javascript API.

Thanks in Advance

Raghu
  • 1. Re: How to access Parent page UIComponent from inlineFrame using ADF javascript
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    the root page is accessible from AdfPage.PAGE --> AdfPage.PAGE.findComponentByAbsoluteId(...)

    The content in the inline frame need to be in the same domain for this cross site scripting

    Frank
  • 2. Re: How to access Parent page UIComponent from inlineFrame using ADF javascript
    Raguraman Explorer
    Currently Being Moderated
    No Frank.. It didn't work.

    I have main.jspx with form id="f1" and an inlineframe, which includes employee.jspx whose form id='f2"

    When I try the following javascript to find the component from employee.jspx whose id is 'f1', it couldn't find the component and says null. But when I try finding 'f2' (i.e. same page where the javascript code resides), it finds. Can you suggest some more area to try?

    {code}
    var comp = AdfPage.PAGE.findComponentByAbsoluteId("f1");
    alert(comp);
    {code}

    Raghu
  • 3. Re: How to access Parent page UIComponent from inlineFrame using ADF javascript
    Raguraman Explorer
    Currently Being Moderated
    The way you suggested didn't help me.

    Yes.. This inlineFrame content is also a part of the same application only. The reason why it is kept in inlineFrame is it is an ADS implemented table. ADS is able to push the data to the table provided we should keep the application idle. If I keep on working with the application (i.e. request/response happens because user works with the bottom portion content of the page), ADS is not able to push the data to UI. Keeping the ADS implemented table in a top portion still but inside an inlineFrame has solved this problem.

    Given below my page design
       main.jspx
       ======
    
       <af:form id="f1"....
           ....
           ....
           <af:inlineframe source="faces/page/employee.jspx" />
           ....
           ....
       </form>
    
       employee.jspx
       =========
    
       <af:form id="f2"
         .....
         ....
        </form>
    
                 
    In the employee.jspx only I have delete button and javascript which is suppose to find the parent page (i.e. main.jspx) and to work with inlineframe component to make it visible/invisible based on whether table gets records or no records. (This javascript call will happen with the help of ClientListener set for the ADS implemented table with event type as propertyChange) Intention is to check the row count of the table during every javascript call and to go to parent page, find the inlineframe, make it visible or invisible.

    Edited by: Raguraman on 25-Jan-2013 08:59
  • 5. Re: How to access Parent page UIComponent from inlineFrame using ADF javascript
    Raguraman Explorer
    Currently Being Moderated
    Repost..

    Can anyone tell me whether we can access the Parent jspx from inline content using javascript? In normal javascript, we can do it by

    What is the equivalent ADF javascript API for the below code?

       main.jspx
       ======
    
       <af:form id="f1"....
           ....
           ....
           <af:inlineframe source="faces/page/employee.jspx" />
           ....
           ....
       </form>
    
       employee.jspx
       =========
       
           <f:view>
            <af:document title="Employee.jspx" id="d2">
                <f:facet name="metaContainer">
                    <af:resource type="javascript">
                        function acceessParentPage(evt)
                        {
                            var parentPageForm = parent.document.getElementById('f1');
                            alert(parentPageForm);
                           
                        }
                    </af:resource>
                </f:facet>
       <af:form id="f2"
         .....
         ....
        </form>
    In the above code snippet, 'f1' represents the main.jspx <af:form>. It should be accessible from Employee.jspx. Employee.jspx is kept in an inlineframe inside main.jspx

    Raghu

    Edited by: Raguraman on Jan 29, 2013 3:32 AM
  • 8. Re: How to access Parent page UIComponent from inlineFrame using ADF javascript
    Raguraman Explorer
    Currently Being Moderated
    Repost... Can anyone tell me? I want to know whether ADF javascript have this or not so that I can decide my further direction on this.

    Edited by: Raguraman on Feb 11, 2013 12:01 AM