This topic is locked
[SOLVED]

Refresh Page after popup

4/7/2025 10:43:33 AM
PHPRunner General questions
P
PK author

I a trying to reload a dashboard (the entire page) after opening a popup from the dashboard and changing a some options.
On my dashboard JSOnLoad:

window.dashPage = pageObj;

On the popup form I have a button that saves some sesssion variables based on the user's choice and then closes the popup form.
On the Client After of the button on the popup I have:

window.dashPage.reload({a:'reload'});

But the dashboard does not reload.
What am I missing?

P
PK author 4/8/2025

Update...I have also set this:

window.dashPage = pageObj;

on the JSOnload of the underlying report on the dashboard but it also doesnt work.
So currently have put a refresh button on the dashboard with the user will have to click after the parameters are set on the popup form for the changes to take effect.
Not very elegant so I would really appreciate some help here
Thank you

C
copper21 4/8/2025

You are going to need to give more information. I got your button to work when I placed on the dashboard. It sounds like you have a button on one of the elements in the dashboard?

Post a screenshot and the button's full code.

P
PK author 4/9/2025

Thanks copper21,

The buttons are not in an element, they are at the top of the page (where you usually have "breadcrumb")

img alt

From top left,

  1. the first button is what I added to refresh the page after the popup closes, because the refresh was not working


  2. The button "Show all shops" clears all "addwhere" conditions and refreshes the page


  3. The button "Show for selected shop" uses the following code to open a popup window for the user to select some shops

    Runner.displayPopup( {
    url: "usershops_dropdown_list.php",
    width: 800,
    height: 500,
    header: 'Select Shop(s)',
    footer: '<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>',

    afterCreate: function(win)
    {
    window.win = win;
    }
    });

  4. Below is the popup window
    img alt


  5. The "Ok" button on the popup window sets the filter conditions in session variables based on the user's selection and in Client After has this code:

    window.parent.win.close();
    window.dashPage.reload({a:'reload'});

    Thats it. So the idea is that once the filter conditions are set, and the dashboard or its element tables/reports/charts are reloaded, the data will change. But becuase the reload doesnt happen when the popup closes, I had to put the refresh button to refresh the page manually, which works but as I said this is not ideal.



Thanks
percy

C
copper21 4/9/2025

Percy,

Take a look at the manual here: https://xlinesoft.com/phprunner/docs/how_to_display_any_page_in_a_popup.htm

The bottom section will help. I have often gotten issues like this and this part of the manual really helps.

Anyway, here is what you need to do...this worked for me:

No JS needed in the dashboard onload event

Code for "Show for selected shop"' client after to open up the popup:

window.popup = Runner.displayPopup({
url: "usershops_dropdown_list.php",
width: 800,
height: 500,
header: 'Select Shop(s)',
footer: '<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>',
});

No need for the function for purposes of this action...use if you still need it for something else.

Code for "OK" client after to close popup and refresh page:

window.parent.location.reload();
window.parent.popup.close();

I hope this helps.

P
PK author 4/10/2025

copper21, This solved my problem, and clears up my understanding of the relationship with the parent page.

Thank you so much!!