- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Google 表格中,我有一个由两部分组成的附加组件 code.gs
和前端 index.html
,其中 index.html 是单击菜单时显示的侧边栏。
这是code.gs
:
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('My add-on')
.addItem('Test', 'openSideBar')
.addToUi();
}
function onSelectionChange(e) {
Logger.log("Selection changed ");
}
function openSideBar() {
var html = HtmlService.createHtmlOutputFromFile('Index');
SpreadsheetApp.getUi().showSidebar(html);
}
function getCurrentSelection() {
var currentCell = SpreadsheetApp.getCurrentCell();
return { column: currentCell.getColumn(), row: currentCell.getRow() };
}
这是
onSelectionChange 的文档.
Logger.log("Selection changed")
确实在选择更改时调用。但是,当用户单击单元格并更改选择时,我需要在前端通知或进行更改。
index.html
:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
Test
<input type="text" id="formula" />
<script>
function onSelectionChangeJs(e) {
document.getElementById("formula").value = e ;
}
function loadCell() {
google.script.run.withSuccessHandler(onSelectionChangeJs).getCurrentSelection();
}
</script>
<button onclick="loadCell()">Get cell</button>
</body>
</html>
虽然目前我正在通过单击按钮检查当前选择,但我需要
onSelectionChangeJs
在工作表中更改选择时自动调用。
onSelectionChange
的
code.gs
通知
onSelectionChangeJs
的
index.html
?
最佳答案
听起来就像当用户更改表格中的单元格时,您希望该更改反射(reflect)在 HTML 页面中,对吗?
什么不将该值发送到 HTML?我认为这需要刷新 HTML 页面,但您可以使用该新参数进行重建。我对附加组件了解得不够多。
但是,如果您只有 onSelectionChange() 触发 Logger.log。它可以触发一个函数,通过将 e 插入到 html id“formula”中来刷新 HTML。
不能直接用代码改变js,但是可以写code.gs,和html js做同样的事情。
这是在你需要的方向吗?
关于google-apps-script - 在前端为 Google Sheets 插件捕获 onSelectionChange,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67749373/
在过去的几天里,我一直在尝试为基于 VUE 的 excel 制作任务 Pane 插件。 我已按照 link 的指南进行操作我试图为 onSelectionChange 注册一个事件处理程序。它已经有些
我有以下代码,当我在文本框中选择文本时,应更新两个变量:selection 和selectionArray。然而,这种情况并非如此。当我运行代码时,selectionArray 会发出警报,它显示变量
我使用 wicket,并且创建了一个像这样的列表选择并覆盖了 onSelectionChanged: ListChoice hotelList = new ListChoice("hotel",
我使用 Angular Material Autocomplete 如下: {{displayFn(option)}} 这是处理程序: onSelectionChange
我正在尝试实现一个文本选择监听器来显示一些自定义选项的工具栏 export default { name: "home", created() { document.onselect
我在 TabControl 中包含两个 TabItem。 每个 TabItem 包含多个 TextBox。 当 TabControl 的 OnSelectionChanged 事件被触发时,以及选择新
是否有一个标准的跨浏览器 HTML5 事件对应于 IE 遗留 onselectionchange (所以当当前选择改变时它被触发)? 已编辑,我正在寻找追踪 Selection object变化。 最
我在 Angular 应用程序中使用 md-autocomplete angular/material: 2.0.0-beta.5。在最新版本中,selected 方法已被 onSelectionCh
我想为 TFileListBox 创建一个新事件。我想知道用户何时选择不同的项目。 实现它的最佳方法是当用户按下鼠标按钮时调用该事件,如下所示: procedure TMyFileList.Mouse
我找到了这个触发器 onSelectionChange(e)在developers.google.com 上,如果选择了单个空单元格,则应将背景设置为红色。我只是复制和粘贴没有得到那个结果。我认为我没
我最近开始使用 Wicket 口。我尝试在您的项目示例中使用“Apache wicket by Vaynberg”一书中的“链接选择框”。 我重新创建了书中的示例: public class Link
在我的 Android 应用程序中,我为 Javascript onselectionchange 附加了一个处理程序,如下所示: $(document).on('selectionchange',f
代码.gs var runSelect = true function onSelectionChange(e) { var sheet = SpreadsheetApp.getActiveShe
我是 React 的新手,当我尝试传递数据表单 onSelectionChange 属性时,但是当我尝试应用它时,表格的选择停止工作 const [selectedRows, setSelectedR
This question already has answers here: How do I make a Sidebar display values from cells? (2 个回答) 1
在 Google 表格中,我有一个由两部分组成的附加组件 code.gs和前端 index.html ,其中 index.html 是单击菜单时显示的侧边栏。 这是code.gs : function
我有一个启用了 SingleSelectionModel 的 GWT CellTable。一旦用户单击一行, onSelectionChange(...) 就会启动我的确认对话框,询问用户是否继续。问
我们继承了使用 Wicket 6 的大型代码库,其中我们有一个首选联系类型选择(短信、电子邮件等)的 RadioGroup。选择 SMS 的 Radio 后,电话号码的 TextField 就会可见,
我有一个包含输入的 mat-form-field 和一个包含 mat-option 的 mat-autocomplete。输入有 (blur) 事件,而 mat-option 有 (onSelecti
我是一名优秀的程序员,十分优秀!