Jump to content
  • 0

Webpage refresh forced upon clicking "update" button in Tabular Report


Leon13

Question

Howdy :)

I added two data pages (Tabular Reports) to my web page.

Only one is editable, the other is only a reference.

Once user updates the editable report I would like to force a webpage refresh.

Already tinkered with the below, but had no luck to get the entire webpage to refresh.

Thank you!  :)

image.png.19d0edde68407f8cf17f2f6623b763ea.png

image.png

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 1

Hi - Just wanted to share this solution. You can use this if you have a Tabular Report with Inline Edit and upon update, you want to reload the whole page. Insert it in the Footer of the DataPage.

<script type="text/javascript">

document.addEventListener('DataPageReady', function (event) {

  document.addEventListener("change", function(event){

    var edit= document.querySelector('[name="Mod0InlineEdit"]');
    
       edit.addEventListener("click", function(){
          window.parent.location = document.referrer;
       });
  });
  
});
</script>
Link to comment
Share on other sites

  • 0
On 1/25/2020 at 3:19 PM, SinJunYoung said:

Hello, if you are familiar with Javascript, you can apply the FormSubmitted on update. Here's the reference: https://howto.caspio.com/datapages/ajax-loading/

Thank you for your response SinJun.

Do I disable Ajax and paste the below in my HTML editor in my site, where I have the code that links to my Caspio data page?

Do I need to edit the code below?  (the "do something" does not look correct to me, but I am still learning..)

Thank you!  :)

 

 

<script type="text/javascript">
document.addEventListener('BeforeFormSubmit', function(event) {
	// do something
});
</script>
Link to comment
Share on other sites

  • 0
On 3/9/2022 at 6:18 AM, Meekeee said:

Hi - Just wanted to share this solution. You can use this if you have a Tabular Report with Inline Edit and upon update, you want to reload the whole page. Insert it in the Footer of the DataPage.

<script type="text/javascript">

document.addEventListener('DataPageReady', function (event) {

  document.addEventListener("change", function(event){

    var edit= document.querySelector('[name="Mod0InlineEdit"]');
    
       edit.addEventListener("click", function(){
          window.parent.location = document.referrer;
       });
  });
  
});
</script>

Hey @Meekeee, thank you for this! I have some minor issue with this. Sometimes the page reloads on inline save/update but sometimes it doesn't. No error is being shown in the console.

Link to comment
Share on other sites

  • 0

I know that this isn't a 100% current thread, but I had a similar challenge and I wanted others to be able to find the solution here. 

I needed to refresh the data page after an Inline Add.  The scenario is that I'm defaulting some values in the inline add record, and I need that code to run each time a record is added.  There might be a better way to do it than refresh the whole page, but this is what I came up with (with fabulous support from Lex in Caspio Support:

<script type="text/javascript">

document.addEventListener('DataPageReady', function (event) {
var addbutton= document.querySelector('[name="Mod0InlineAdd"]');
addbutton.addEventListener("click", function(event){
location.reload()

});

});
</script>

 

Link to comment
Share on other sites

  • 0

If the same solution is used for a single DataPage (for any reason), the following modification of the script would work:

 

<script type="text/javascript">

document.addEventListener('DataPageReady', function (event) {

  document.addEventListener("change", function(event){

    var edit= document.querySelector('[name="Mod0InlineEdit"]');
    
       edit.addEventListener("click", function(){
          window.parent.location.href = window.location.href;
       });
  });
  
});
</script>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...