How do I refresh a menu page after update page?

I have a menu/list page (see screenshot) which links to several other pages. If I click on “2 images” on the top line, I go to a second SPA page where I can upload images. The “2 images” comes from a COUNT() in the DB query.

So if I go to the second page, upload an image, and return to this menu page, the “2 images” should update to “3 images” but it does not.

From the update page I can press the browser’s ‘back’ button, press my own ‘back’ button or go through the menus to get to the menu page but in all instances the menu page does not update.

The only way to update it is by pressing F5 to refresh the page. How can I get the menu page to update automatically?

How are you getting back to the first page after the up load ??

As I said, the user can press the browser’s ‘back’ button, press my own ‘back’ button or go through the menus to get back to the menu page.

OK 3 ideas for you.

1: Why don’t you put the file upload into a Modal and then on upload of the image, simply add a data refresh on upload success

2: Add a schedule to do a refresh on the data base.

3: On the file upload add a session value for say ‘Upload-Refresh = 1’ and then on the data page you go back to add a refresh if value = 1 (after the refresh set the value to 0) this way it is only refreshing when the value is set.

Hope that may help to give you some ideas.

1 Like

Hi @Teodor, sorry to bother you directly, I was wondering if you could confirm that Peter’s suggestion number 3 is the best option or if there is a better way.

I much appreciate your input as always.

Why not do it using the onsuccess of upload action to reload the server action returning the results on your page?

I do have an “on-success” in the Form on the page with the FileUpload

dmx-on:success="notifies1.success('Successfully Updated');sc_upload_img_pq.load({job_id: query.job_id},true);form_img_upload.reset()" 

but that only refreshes the upload page

after the upload

But then when you go to the menu page, it still only shows ‘1’ image.

image

I don’t understand you sorry. Are you refreshing the upload action with this sc_upload_img_pq.load({job_id: query.job_id},true);? Or what is it doing?>

You need to reload the server action which lists the COUNT on the page …

You are correct. The question is, how do I refresh the Server Action which lists the COUNT on the listing page? That’s where I am struggling.

Move the server action to the main page instead. Then you will be able to reload it using the dynamic events.

Interesting. I wouldn’t have thought of that. It does make sense.

I have moved the Server Connect (the FileUpload one) from the SPA include page to the parent page. I have then selected the same Server Connect and created a Success Dynamic Event where I have selected the listings Server Connect:sc_q_live_reports LOAD action.

Saved everything. Refreshed. Cleared Cached Images and Files.

But the listings page still does not update. What am I doing wrong?

Am I moving the wrong Server Action to the parent page?

*** EDIT ***

That was it, I moved the Sever Connect for the listings page to the parent page.
This now works.
Many thanks @Teodor, I wouldn’t have got there without your help
Cheers

I don't know, names like sc_q_live_reports tell me nothing really.

You need to move the action used to list your records to the main page ... that is the one you want to reload. Upload hs nothing to do with showing data on the page ....

Thanks @Teodor, see my comment/edit above.