对于使用多选菜单的 SelectionInput
widget,数据源为 Google Workspace。用于填充多选菜单中的项。
const platformDataSource = CardService.newPlatformDataSource() .setCommonDataSource(CardService.CommonDataSource.USER); const multiSelect = CardService.newSelectionInput() .setType(CardService.SelectionInputType.MULTI_SELECT) .setFieldName("contacts") .setTitle("Selected contacts") .setMultiSelectMaxSelectedItems(5) .setMultiSelectMinQueryLength(1) .setPlatformDataSource(platformDataSource);
仅适用于 Google Chat 应用。不适用于 Google Workspace 插件。
方法
方法 | 返回类型 | 简介 |
---|---|---|
setCommonDataSource(commonDataSource) | PlatformDataSource | 从 Google Workspace 设置数据源。 |
setHostAppDataSource(hostAppDataSource) | PlatformDataSource | 用于填充多选菜单中的空格。 |
详细文档
setCommonDataSource(commonDataSource)
从 Google Workspace 设置数据源。
const platformDataSource = CardService.newPlatformDataSource() .setCommonDataSource(CardService.CommonDataSource.USER); const multiSelect = CardService.newSelectionInput() .setType(CardService.SelectionInputType.MULTI_SELECT) .setFieldName("contacts") .setTitle("Selected contacts") .setMultiSelectMaxSelectedItems(5) .setMultiSelectMinQueryLength(1) .setPlatformDataSource(platformDataSource);仅适用于 Google Chat 应用。不适用于 Google Workspace 插件。
参数
名称 | 类型 | 说明 |
---|---|---|
commonDataSource | CommonDataSource | 要设置的数据源。 |
弃踢回攻
PlatformDataSource
- 此对象,用于链接。
setHostAppDataSource(hostAppDataSource)
用于填充多选菜单中的空格。
const chatSpaceDataSource = CardService.newChatSpaceDataSource() .setDefaultToCurrentSpace(true); const chatClientDataSource = CardService.newChatClientDataSource() .setSpaceDataSource(chatSpaceDataSource); const hostAppDataSource = CardService.newHostAppDataSource() .setChatDataSource(chatClientDataSource); const platformDataSource = CardService.newPlatformDataSource() .setHostAppDataSource(hostAppDataSource); const multiSelect = CardService.newSelectionInput() .setType(CardService.SelectionInputType.MULTI_SELECT) .setFieldName("contacts") .setTitle("Selected contacts") .setMultiSelectMaxSelectedItems(5) .setMultiSelectMinQueryLength(1) .setPlatformDataSource(platformDataSource);仅适用于 Google Chat 应用。不适用于 Google Workspace 插件。
参数
名称 | 类型 | 说明 |
---|---|---|
hostAppDataSource | HostAppDataSource | 要设置的数据源。 |
弃踢回攻
PlatformDataSource
- 此对象,用于链接。