如何刷新页面,Google应用脚本网络 [英] How to refresh page, Google app Script Web

查看:52
本文介绍了如何刷新页面,Google应用脚本网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下午好.

我正在尝试创建一个按钮来通过Google应用程序脚本Web刷新页面,但是方法" window.location.reload(); "不起作用,有人可以帮忙吗?

I am trying to create a button to refresh the page, through the Google app Script Web, but the method "window.location.reload ();", does not work could someone help?

链接谷歌应用程序脚本网站: HTTPS://script.google.com/d/1jyWe9jm0dIqHsY1uKJZ0pOJYzLuq9dip1cSsXhxBwv53cFakW2LHgM_n/edit MID = ACjPJvGbLXQwvhjDh7fsdifcTFvgQby-gsIUWeCSmwUzTdnVvXw8LNckG8rXcsyhcYvAcWAN7pU4E05bQEJwZl_1189N-bwyvttAxpHxmbvzUvx_d9SDKh19x3VzY9XxClhXweVlmqdMOSs&安培; UIV = 2

link Google app Script Web: https://script.google.com/d/1jyWe9jm0dIqHsY1uKJZ0pOJYzLuq9dip1cSsXhxBwv53cFakW2LHgM_n/edit?mid=ACjPJvGbLXQwvhjDh7fsdifcTFvgQby-gsIUWeCSmwUzTdnVvXw8LNckG8rXcsyhcYvAcWAN7pU4E05bQEJwZl_1189N-bwyvttAxpHxmbvzUvx_d9SDKh19x3VzY9XxClhXweVlmqdMOSs&uiv=2

<html>

<base target="_se">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://tablesorter.com/__jquery.tablesorter.min.js" type="text/javascript"></script>

<button onclick="sortTable()">Sort</button>
<button onclick="refresh()">refresh </button>

  <table class="striped centered ajuste" id="tab">
           <thead >           
             <tr>

              <th>ID</th>
              <th>NOME</th>
              <th>DATA</th>

             </tr>
           </thead>
            <tbody id="coportoTabela">

            </tbody>
  </table>

 document.addEventListener("DOMContentLoaded", function(){

        google.script.run.withSuccessHandler(gerarTabela).pegarTabelaEstoque();

  });

  function gerarTabela(dataArray){
    var tcorpo =  document.getElementById("coportoTabela");    

     dataArray.forEach(function(r){

     var linha = document.createElement("tr");

     var coluna1 = document.createElement("td");
     coluna1.textContent = r[0];
     var coluna2 = document.createElement("td");
     coluna2.textContent = r[1];
     var coluna3 = document.createElement("td");
     coluna3.textContent = r[2];

     linha.appendChild(coluna1);
     linha.appendChild(coluna2);
     linha.appendChild(coluna3);

     tcorpo.appendChild(linha); 

     });      

  }


   function refresh(){
     window.location.reload();
   }     

推荐答案

尝试一下:

Javascript:

Javascript:

function reLoad() {
       google.script.run
      .withSuccessHandler(function(url){
        window.open(url,'_top');
      })
      .getScriptURL();
}

GS:

function getScriptURL() {
  return ScriptApp.getService().getUrl();
}

这篇关于如何刷新页面,Google应用脚本网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆