首页 > 解决方案 > 服务器端更改后客户端重新加载记录

问题描述

在服务器脚本中调用 app.saveRecords() 后,我必须在任何客户端页面上点击刷新(在 Chrome 中)以重新加载数据源。在服务器上的 saveRecords() 之后我可以调用什么来强制客户端刷新吗?

标签: google-app-maker

解决方案


此客户端脚本代码有效:

function addCont(widget) {

  var holder = widget.root.descendants;

  var con = {
    barcode: holder.Barcode.value,
    part: holder.Part.value,
    location: holder.Location.value
  };

  google.script.run.withSuccessHandler(function(result) {
    console.log("Container Added");

    // This forces the other pages to reload after the server adds the record
    widget.root.datasource.load();

    clearAddCont(widget);
  }).addContainer(con);
}

推荐阅读