如何使用多个Google文件选取器处理回电 [英] How do I handle the call back using multiple Google File Picker

查看:85
本文介绍了如何使用多个Google文件选取器处理回电的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在一个页面上有多个Google Drive File Pickers,我该如何处理回调以确保数据传递到正确的部分?

我基本上有一个列出的项目数量,每个项目都有一个选择文件按钮链接到文件选取器。所有的例子只是将数据传回到同一个地方,但我需要这个对于每个请求都是不同的。



我基本上有相同的代码包含在文档中:

https://developers.google.com/apps-script/guides/dialogs#file-open_dialogs

我该怎么做?

正如Eric所说的那样,使用setCallback方法。



如果您想将参数传递给回调函数,请使用匿名函数:



.setCallback(function(data){pickerCallback(data,MYPICKERID)})

If I have multiple Google Drive File Pickers on one page how do I handle the callback to ensure the data is passed to the correct section?

I basically have a number of items listed, each Item has a select a file button linked to the file picker. All the examples just pass the data back to the same place but I need this to be different for each request.

I'm basically have the same code that is included in the docs:

https://developers.google.com/apps-script/guides/dialogs#file-open_dialogs

How can I do this?

解决方案

As Eric said use the setCallback method.

If you want to pass a parameter to a callback use an anonymous function:

.setCallback(function(data){pickerCallback(data,"MYPICKERID")})

这篇关于如何使用多个Google文件选取器处理回电的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆