Reload or Refresh

I have an import function that works great, however I can't seem to find where I should add code to refresh the page. I've tried several places in my code, however none seem to work.

 

Thanks

 

Hi 367978297211

Thank you for the "location.hash = location.hash + "#" " code. 

I've been searching far and wide for code that would enable me to refresh the same scene that a form is located on. Reloading the whole page was causing an issue, as it was forcing users to log in again. And it caused an even bigger issue where we have an app embedded in another app.

This works perfectly, as it refreshes the whole scene, and as a result also applies the Page Rules again for that scene. My code snippet below that displays an alert, and refreshes the scene after the delay specified:

$(document).on('knack-record-update.view_2855', function(event, view, data) {

setTimeout(function () { location.hash = location.hash + "#"; }, 12000);

alert("Please wait while we fetch the Invoice from Autoline. Click 'OK' & this page will refresh in a few moments...");

Knack.showSpinner();

});

Thank you!

Hi Martin, you may need to look at finding the correct javascript trigger, but here is what we use in the API& Code section in the builder under Javascript

 

// does a quick refresh on the store add line item order screen
$(document).on('knack-record-create.view_901', function(event, view, record) {
location.hash = location.hash + "#"
});

 

You'll need to find your view number (instead of view_901) and you'll need to work out with your input what is the trigger. In my example we are tracking knack-record-create

We find the location.hash = location.hash + "#" works really well as it doesn't refresh the entire page and does its refresh very quickly.

 

I hope this helps a little!

Cheers