user9052443
user9052443

Reputation: 1

How do I force a refresh in google app maker

I have a simple panel that includes a form and a table. All data but one column in the table are entered. The values in the non-entry column are calculated. How do I get the table to refresh itself when after I run a server side script to calculate a new value to show updated table?

Upvotes: 0

Views: 1571

Answers (1)

Pavel Shkleinik
Pavel Shkleinik

Reputation: 6347

If you run your server script from client, then you'll need to use use callback:

google.script.run
  .withSuccessHandler(function() {
    app.datasources.MyDatasource.load();
  })
  .withFailureHandler(function() {
    // TODO: handle error
  })
  .myServerScript();

In case your server script is executed by some schedule (trigger) or by other users then you'll need to reload table's datasource from time to time:

// Page  onAttach event handler
var interval = setInterval(function() {
    app.datasources.MyDatasource.load();
  }, 3000);

// Page onDetach event handler
clearInterval(interval);

Upvotes: 5

Related Questions