简体   繁体   English

导航到其他页面谷歌应用程序脚本 UiApp

[英]Navigate to other pages google apps script UiApp

Can someone explain to me how to go about navigating to a new page in google apps script is done ?有人可以向我解释如何在谷歌应用程序脚本中导航到新页面吗? My initial thought is to hide or delete all child elements within the app and then rebuild it accordingly.我最初的想法是隐藏或删除应用程序中的所有子元素,然后相应地重建它。 Is this the right approach ?这是正确的方法吗?

thanks in advance提前致谢

One way is to have different panels representing different pages.一种方法是让不同的面板代表不同的页面。 Initially hide all but the first page and then unhide subsequent pages最初隐藏除第一页之外的所有页面,然后取消隐藏后续页面

Srik already arrived one very common approach for page navigation/organization. Srik 已经推出了一种非常常见的页面导航/组织方法。

Here is another way using a query string attribute to fork off to a different UI path.这是使用查询字符串属性分叉到不同 UI 路径的另一种方法。 This has the added benefit of getting the activity "spinner".这具有获得活动“微调器”的额外好处。

You can see it in action at this link below with the code powering it underneath it.您可以在下面的此链接中看到它的实际运行情况,并在其下方提供支持它的代码。 Hope this provides another perspective.希望这提供了另一个视角。

https://script.google.com/macros/s/AKfycbx68wR5HmCbil_LY8LlMd2m16_xNEdEtXq7-YfgqsMPqeoe-E3L/exec https://script.google.com/macros/s/AKfycbx68wR5HmCbil_LY8LlMd2m16_xNEdEtXq7-YfgqsMPqeoe-E3L/exec

function doGet(e) {
  var app = UiApp.createApplication();
  var page = e.parameter.page

  //add a default page
  if(!page){
    page = '1';  
  }

  if(page === '1'){
    var label = app.createLabel('You are in page 1.')

    var anchor = app.createAnchor("Next page",ScriptApp.getService().getUrl()+"?page=2");
    anchor.setTarget('_self');

    app.add(label);
    app.add(anchor);
  }
  else if(page === '2'){
    var label = app.createLabel('You are in page 2, now.')

    var anchor = app.createAnchor("Go back",ScriptApp.getService().getUrl()+"?page=1");
    anchor.setTarget('_self');

    app.add(label);
    app.add(anchor);
  }

  return app;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM