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
Method | Return type | Brief description |
---|---|---|
addCloseHandler(handler) | DocsListDialog | Add a handler for close events. |
addSelectionHandler(handler) | DocsListDialog | Add a handler for selection events. |
addView(fileType) | DocsListDialog | Add a type of file that this DocsListDialog will show. |
getId() | String | Returns the id that has been assigned to this object. |
getType() | String | Gets the type of this object. |
setDialogTitle(title) | DocsListDialog | Set the title of this DocsListDialog . |
setHeight(height) | DocsListDialog | Set the height of this DocsListDialog . |
setInitialView(fileType) | DocsListDialog | Set the initial type of file that this DocsListDialog will show. |
setMultiSelectEnabled(multiSelectEnabled) | DocsListDialog | Set whether multiple items can be selected. |
setWidth(width) | DocsListDialog | Set the width of this DocsListDialog . |
showDocsPicker() | DocsListDialog | Show 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
ServerHandler
s 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
Name | Type | Description |
---|---|---|
handler | Handler | the 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
ServerHandler
s 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
Name | Type | Description |
---|---|---|
handler | Handler | the 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
Name | Type | Description |
---|---|---|
fileType | FileType | the 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
Name | Type | Description |
---|---|---|
title | String | the new title. |
Return
DocsListDialog
— the DocsListDialog
itself, useful for chaining.
setHeight(height)
Set the height of this DocsListDialog
.
Parameters
Name | Type | Description |
---|---|---|
height | Integer | the 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
Name | Type | Description |
---|---|---|
fileType | FileType | the type of file to show. |
Return
DocsListDialog
— the DocsListDialog
itself, useful for chaining.
setMultiSelectEnabled(multiSelectEnabled)
Set whether multiple items can be selected.
Parameters
Name | Type | Description |
---|---|---|
multiSelectEnabled | Boolean | whether multiple items can be selected. |
Return
DocsListDialog
— the DocsListDialog
itself, useful for chaining.
setWidth(width)
Set the width of this DocsListDialog
.
Parameters
Name | Type | Description |
---|---|---|
width | Integer | the new width, in pixels. |
Return
DocsListDialog
— the DocsListDialog
itself, useful for chaining.
showDocsPicker()
Show this DocsListDialog
.
Return
DocsListDialog
— the DocsListDialog
itself, useful for chaining.