从谷歌应用脚本 html 模板呈现 html
render html from Google apps script html template
我正在使用基于 html 模板的 Google 应用程序脚本开发独立的 Web 应用程序。该应用程序的目的是一个简单的gmail,但带有自定义过滤器。 我已经完成了该过滤器并显示电子邮件列表,但遇到了呈现消息的html正文的问题。
下面是代码的一部分:
网页模板:
<table id="myTable">
</table>
<script>
...
for (var i = 0; i < threads.length; i++)
{
var row = table.insertRow(0);
row.setAttribute("messageId", threads[i].id);
row.onclick = (function() {
google.script.run.openMessage(this.getAttribute("messageId"));
});
var cell1 = row.insertCell(0);
cell1.innerHTML = threads[i].subject;
}
...
</script>
谷歌脚本:
function doGet() {
return HtmlService
.createTemplateFromFile('index')
.evaluate().setSandboxMode(HtmlService.SandboxMode.NATIVE);
}
...
function openMessage(id)
{
var message = GmailApp.getMessageById(id);
var body = HtmlService.createHtmlOutput(message.getBody());
}
...
问题是:点击时显示邮件正文的最佳方式是什么?当我尝试在新窗口中打开它时 ( window.open()...
)b 它会出现错误,模式窗口也无法从 html 模板中工作。提前感谢任何帮助!
我终于找到了问题的答案,它是 - jquery 对话框。
<div id="dialog"></div>
function openDialog(html) {
$("#dialog-confirm").html(html);
$("#dialog-confirm").dialog({
resizable: true,
modal: true,
title: "Message",
height: 500,
width: 500,
});
}
相关文章:
- 开箱即用的Light Switch HTML应用程序在IE9中存在null错误
- 将迁移的Silverlight到HTML应用程序划分为NPM模块
- 带有弹出窗口的Windows应用商店HTML应用程序
- Windows 8 Metro UI HTML 应用中的自定义可重用 UI 组件
- 如何从一个 HTML 应用脚本文件中获取 JSON 数据
- 从 HTML 应用程序与 Flex 应用程序运行时出现 ActiveXObject 错误
- 将服务器 HTML 应用更改为独立的桌面应用
- 无法在安卓HTML应用程序中加载外部JS文件
- HTML应用程序类似于Air Sketch
- HTML应用程序横向
- 如何在html应用程序中保护解析的Rest API密钥
- iOS5 Safari:键盘不会隐藏在主屏幕的HTML应用程序中
- 使用Laravel路由的HTML应用中的CSRF
- 在heroku中部署HTML应用程序时出现构建错误
- Jquery不工作在Windows8 HTML 5应用程序
- 播放声音悬停在adobeair HTML应用程序
- 试图从运行javascript的html应用程序调用excel宏
- Grid For HTML应用程序
- Jquery跨域Ajax - Windows通用HTML应用程序
- 纯Javascript和HTML应用程序&通过CDN部署…好主意