导航到其他页面谷歌应用脚本UiApp [英] Navigate to other pages google apps script UiApp
问题描述
提前致谢
已经到达了页面导航/组织的一种非常常见的方法。
这是另一种使用查询字符串属性分离到不同UI路径的方法。这有额外的好处,让活动微调。
你可以在下面的链接中看到它的动作,代码在它下面给它启动。希望这提供了另一个角度。
https: //script.google.com/macros/s/AKfycbx68wR5HmCbil_LY8LlMd2m16_xNEdEtXq7-YfgqsMPqeoe-E3L/exec
函数doGet( e){
var app = UiApp.createApplication();
var page = e.parameter.page
//添加一个默认页面
if(!page){
page ='1';
}
if(page ==='1'){
var label = app.createLabel('您位于第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('现在你在第2页')
var anchor = app.createAnchor(Go back,ScriptApp.getService()。getUrl()+?page = 1);
anchor.setTarget('_ self');
app.add(label);
app.add(anchor);
}
返回应用;
}
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
Srik already arrived one very common approach for page navigation/organization.
Here is another way using a query string attribute to fork off to a different UI path. 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
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;
}
这篇关于导航到其他页面谷歌应用脚本UiApp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!