Reputation: 111
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?
Upvotes: 0
Views: 771
Reputation: 5782
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")})
Upvotes: 1
Reputation: 12671
You can change the callback function that the picker uses with this line:
.setCallback(pickerCallback)
Use a different callback for each picker, or even use an anonymous function.
Upvotes: 0