Google Apps Script
Feedback on this document

Class DocsListDialog

A file picker for files saved in Google Docs.

Unlike most UiApp objects, DocsListDialog should not be added to the UiInstance. Here is small sample that demonstrates how to display it.

 function init() {
   var app = UiApp.createApplication().setTitle("My Sample");
   app.createDocsListDialog().showDocsPicker();
   return app;
 }

 function doGet() {
   return init();
 }
 

Methods

MethodReturn typeBrief description
addCloseHandler(handler)DocsListDialogAdd a handler for close events.
addSelectionHandler(handler)DocsListDialogAdd a handler for selection events.
addView(fileType)DocsListDialogAdd a type of file that this DocsListDialog will show.
getId()StringReturns the id that has been assigned to this object.
getType()StringGets the type of this object.
setDialogTitle(title)DocsListDialogSet the title of this DocsListDialog.
setHeight(height)DocsListDialogSet the height of this DocsListDialog.
setInitialView(fileType)DocsListDialogSet the initial type of file that this DocsListDialog will show.
setMultiSelectEnabled(multiSelectEnabled)DocsListDialogSet whether multiple items can be selected.
setWidth(width)DocsListDialogSet the width of this DocsListDialog.
showDocsPicker()DocsListDialogShow this DocsListDialog.

Detailed documentation

addCloseHandler(handler)

Add a handler for close events.

Note that you can have multiple handlers for the same event on the same widget. They will be called in the order that they were added to the widget, although ServerHandlers may appear to happen simultaneously.

The handler passes back some information to the server about what happened. This information can be accessed as follows:

 {code
 function doGet() {
   var app = UiApp.createApplication();
   var item1 = app.createTreeItem("item1");
   item1.addItem(app.createTreeItem("item2"));
   var tree = app.createTree();
   tree.addItem(item1);
   var handler = app.createServerHandler("handlerFunction");
   tree.addCloseHandler(handler)
   app.add(tree);
   return app;
 }

 function handlerFunction(eventInfo) {
   var parameter = eventInfo.parameter;
   // the type of event, in this case "close".
   var eventType = parameter.eventType;
   // the id of the widget that fired this event.
   var source = parameter.source;
 }
 }
In addition, the values of certain widgets can be sent up with the event as well as "callback elements." See the documentation of ServerHandler for more information.

Parameters

NameTypeDescription
handlerHandlerthe handler to execute when the event occurs. This can be a ClientHandler or a ServerHandler.

Return

DocsListDialog — the DocsListDialog itself, useful for chaining.


addSelectionHandler(handler)

Add a handler for selection events.

Note that you can have multiple handlers for the same event on the same widget. They will be called in the order that they were added to the widget, although ServerHandlers may appear to happen simultaneously.

The handler passes back some information to the server about what happened. This information can be accessed as follows:

 function doGet() {
   var app = UiApp.createApplication();
   var item1 = app.createTreeItem("item1");
   item1.addItem(app.createTreeItem("item2"));
   var tree = app.createTree();
   tree.addItem(item1);
   var handler = app.createServerHandler("handlerFunction");
   tree.addSelectionHandler(handler)
   app.add(tree);
   return app;
 }

 function handlerFunction(eventInfo) {
   var parameter = eventInfo.parameter;
   // the type of event, in this case "selection".
   var eventType = parameter.eventType;
   // the id of the widget that fired this event.
   var source = parameter.source;
 }
 
In addition, the values of certain widgets can be sent up with the event as well as "callback elements." See the documentation of ServerHandler for more information.

Parameters

NameTypeDescription
handlerHandlerthe handler to execute when the event occurs. This can be a ClientHandler or a ServerHandler.

Return

DocsListDialog — the DocsListDialog itself, useful for chaining.


addView(fileType)

Add a type of file that this DocsListDialog will show.

Parameters

NameTypeDescription
fileTypeFileTypethe type of file to add.

Return

DocsListDialog — the DocsListDialog itself, useful for chaining.


getId()

Returns the id that has been assigned to this object.

This can be used in conjunction with app.getElementById() to retrieve a reference to this object.

Return

String — the id that has been assigned to this object


getType()

Gets the type of this object.

Return

String — the object type


setDialogTitle(title)

Set the title of this DocsListDialog.

Parameters

NameTypeDescription
titleStringthe new title.

Return

DocsListDialog — the DocsListDialog itself, useful for chaining.


setHeight(height)

Set the height of this DocsListDialog.

Parameters

NameTypeDescription
heightIntegerthe new height, in pixels.

Return

DocsListDialog — the DocsListDialog itself, useful for chaining.


setInitialView(fileType)

Set the initial type of file that this DocsListDialog will show.

Parameters

NameTypeDescription
fileTypeFileTypethe type of file to show.

Return

DocsListDialog — the DocsListDialog itself, useful for chaining.


setMultiSelectEnabled(multiSelectEnabled)

Set whether multiple items can be selected.

Parameters

NameTypeDescription
multiSelectEnabledBooleanwhether multiple items can be selected.

Return

DocsListDialog — the DocsListDialog itself, useful for chaining.


setWidth(width)

Set the width of this DocsListDialog.

Parameters

NameTypeDescription
widthIntegerthe new width, in pixels.

Return

DocsListDialog — the DocsListDialog itself, useful for chaining.


showDocsPicker()

Show this DocsListDialog.

Return

DocsListDialog — the DocsListDialog itself, useful for chaining.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.