Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

createDocsListDialog setInitialView error

Back again with the createdocsListDialog function :)

I've got it working however, I'd like to limit the files to be selected to be only spreadsheets.

"Error encountered: Cannot find method setInitialView(string). (line 13)"

The .setInitialView appears in the script editor as a method, but when running.. not so much. Here's the code.

var doclisthandler = app.createServerHandler('selectionhandler'); var doclist = app.createDocsListDialog().showDocsPicker() .addSelectionHandler(doclisthandler).setInitialView('spreadsheet');

Any ideas?

like image 349
Joe Foley Avatar asked May 30 '26 08:05

Joe Foley


1 Answers

From the code completion itself you can see that the setInitialView function does not expect a string as parameter, but a FileType constant. On the docs you can see it is called SPREADSHEETS.

Here is how it works:

app.createDocsListDialog().showDocsPicker().
  addSelectionHandler(doclisthandler).setInitialView(UiApp.FileType.SPREADSHEETS)
like image 110
Henrique G. Abreu Avatar answered Jun 02 '26 03:06

Henrique G. Abreu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!