This discussion is archived
4 Replies Latest reply: Jul 21, 2013 9:20 AM by BAO.SZ RSS

How to refresh current page after return from a popup dialog?

BAO.SZ Newbie
Currently Being Moderated

Hi,

In jdev 11.2.3,

In a jsff page,I have a commandbutton to launch a popup dialog, and actionListener like this:

                    <af:commandButton text="Select Bills" id="cb1" actionListener="#{newReceiptBean.refreshBillPending}">

                        <af:showPopupBehavior popupId="p1"/>

                    </af:commandButton>

 

or

                    <af:commandButton text="Select Bills" id="cb1" actionListener="#{newReceiptBean.refreshBillPending}"

                                      action="#{newReceiptBean.refreshBillPending}">

                        <af:showPopupBehavior popupId="p1"/>

But the "newReceiptBean.refreshBillPending" method cannot be executed even though  it can be executed by another button like this:

<af:commandButton text="ExecuteWithParams"

                                      disabled="#{!bindings.ExecuteWithParams.enabled}" id="cb3"

                                      action="#{newReceiptBean.refreshBillPending}"/>

 

How to execute a bean method, after return from a pupup dialog?

Thanks!

 

Message was edited by: BAO.SZ It seems after setting showPopupBehvior for the button, the "action", and "actionListener" cannot be executed anymore. Can someone give any help? Thanks.

  • 1. Re: How to refresh current page after return from a popup dialog?
    BAO.SZ Newbie
    Currently Being Moderated

    I change the page codes for button which will launch the popup dialog as follows:

                        <af:commandButton text="Select Bills" id="cb1" action="selectBillPending"

                                                                             useWindow="true"

                                         returnListener="#{backingBeanScope.backing_launch_page.backFromPopup}"

                                         binding="#{backingBeanScope.backing_launch_page.cb1}" partialSubmit="true"

                                          immediate="true">

                            <af:showPopupBehavior popupId="p1"/>

                        </af:commandButton>

    and back bean codes:

        public void backFromPopup(ReturnEvent returnEvent) {
            // Add event code here...
            //
            AdfFacesContext adfFacesContext;
            adfFacesContext = AdfFacesContext.getCurrentInstance();
            adfFacesContext.addPartialTarget(Bill4NewReceiptPending);
           
            //actionEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
                 
            BindingContainer bindings2 = getBindings();
            System.out.println(" :bindings2: "+bindings2);
            OperationBinding operationBinding2 = bindings2.getOperationBinding("ExecuteWithParams");
            Object result = operationBinding2.execute();
            if (!operationBinding2.getErrors().isEmpty()) {
                 return ;
            }

        }

     

    That is:

    Add a returnListener and binding to the button,

    (and also there is a bounded workflow to call selectBillPending, but in fact that will not work).

     

    When run this page, I found the returnListener didn't executed at all.

     

    Anyone call help ?

    Thanks.

  • 2. Re: How to refresh current page after return from a popup dialog?
    vinaykumar2 Expert
    Currently Being Moderated

    i am not sure i understand ur requirment clearly.But do u hve any ok or cancel button in ur popup?

     

    Well u can use diaglogListener in ur popup if u using dialog.in ur dialoglistener execute ur bean method.

     

     

    see this as well

     

    Handling Ok and Cancel button in af:dialog using popup in Oracle ADF by dialogListener | Techartifact

  • 3. Re: How to refresh current page after return from a popup dialog?
    Timo Hahn Oracle ACE
    Currently Being Moderated

    Message was edited by: BAO.SZ It seems after setting showPopupBehvior for the button, the "action", and "actionListener" cannot be executed anymore. Can someone give any help? Thanks.

    The showPopupBehavior is a client behavior tag which cancels the event. Your observation is right, after the client event no actionListener or action will execute.

     

    Your real question now is how to call a method after a popup is closed.

    One solution is to use a af:dialog in the popup where you define a dialogListener  to catch the outcome of the dialog and if it's OK you call your other method.

     

    Timo

  • 4. Re: How to refresh current page after return from a popup dialog?
    BAO.SZ Newbie
    Currently Being Moderated

    Followed what vinay and Timo sugguested:

    One solution is to use a af:dialog in the popup where you define a dialogListener  to catch the outcome of the dialog and if it's OK you call your other method.

    I wrote method code in back bean like this:

        public void refreshBillFromDialog(DialogEvent dialogEvent) {

            // Add event code here...

            if (dialogEvent.equals(false)){

                return;

            }

            AdfFacesContext adfFacesContext;

            adfFacesContext = AdfFacesContext.getCurrentInstance();

            adfFacesContext.addPartialTarget(Bill4NewReceiptPending);

           

            //actionEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());

                 

            BindingContainer bindings2 = getBindings();

            System.out.println(" refreshBillFromDialog:bindings2: "+bindings2);

            OperationBinding operationBinding2 = bindings2.getOperationBinding("ExecuteWithParams");

            Object result = operationBinding2.execute();

            if (!operationBinding2.getErrors().isEmpty()) {

                 return ;

            }

    And it works: the adf table(Bill4NewReceiptPending) in the calling page will be refreshed after the dialog popup was closed!

    Thank you all!

     

    What's more, I found even if I use bounded workflow calling instead of using popup dialog calling, the  returnListener wasnot executed either.

    And there is still a issue in the popup Dialog: The strange behavior of checkbox selection, see the thread:

    Why the page cannot refresh correctly after making checkbox selection?

     

    I tried and put aside for some days, and have no idea yet.

    Can anyone give helps?

    Thanks!