Class UpdatedWidget
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
วิดเจ็ตที่อัปเดตแล้ว
การตอบสนองของวิดเจ็ตที่อัปเดต ใช้เพื่อระบุตัวเลือกการเติมข้อความอัตโนมัติสำหรับเมนูแบบเลือกหลายรายการใน SelectionInput
const updatedWidget = CardService.newUpdatedWidget()
.addItem(
'item_one_title',
'item_one_value',
false,
'item_one_uri',
'item_one_bottom_text',
)
.addItem(
'item_two_title',
'item_two_value',
false,
'item_two_uri',
'item_two_bottom_text',
);
ใช้ได้กับแอป Google Chat เท่านั้น ไม่พร้อมใช้งานสำหรับส่วนเสริมของ Google Workspace
เอกสารประกอบโดยละเอียด
addItem(text, value, selected, startIconUri, bottomText)
เพิ่มรายการใหม่ที่เลือกได้
const updatedWidget = CardService.newUpdatedWidget()
.addItem(
'item_one_title',
'item_one_value',
false,
'item_one_uri',
'item_one_bottom_text',
)
.addItem(
'item_two_title',
'item_two_value',
false,
'item_two_uri',
'item_two_bottom_text',
);
ใช้ได้กับแอป Google Chat เท่านั้น ไม่พร้อมใช้งานสำหรับส่วนเสริมของ Google Workspace
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
text | Object | ข้อความที่จะแสดงสําหรับรายการนี้ ระบบจะแปลงอาร์กิวเมนต์พื้นฐานที่ไม่ใช่สตริงเป็นสตริงโดยอัตโนมัติ |
value | Object | ค่าอินพุตของแบบฟอร์มที่ส่งผ่าน Callback ระบบจะแปลงอาร์กิวเมนต์พื้นฐานที่ไม่ใช่สตริงเป็นสตริงโดยอัตโนมัติ |
selected | Boolean | รายการจะเลือกไว้โดยค่าเริ่มต้นหรือไม่ หากอินพุตการเลือกยอมรับเพียงค่าเดียว (เช่น สําหรับปุ่มตัวเลือกหรือเมนูแบบเลื่อนลง) ให้ตั้งค่าช่องนี้สําหรับรายการเดียวเท่านั้น |
startIconUri | Object | สำหรับเมนูแบบเลือกหลายรายการ ให้ระบุ URL ของไอคอนที่แสดงข้างช่องข้อความของรายการ รองรับไฟล์ PNG และ JPEG |
bottomText | Object | สำหรับเมนูแบบเลือกหลายรายการ ให้ใช้คำอธิบายข้อความหรือป้ายกำกับที่แสดงใต้ช่องข้อความของรายการ |
รีเทิร์น
UpdatedWidget
— ออบเจ็กต์นี้สําหรับการต่อเชื่อม
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003e\u003ccode\u003eUpdatedWidget\u003c/code\u003e provides autocomplete options for multiselect menus in SelectionInput, specifically for Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eIt allows adding items with customizable text, value, selection state, icon, and bottom text using the \u003ccode\u003eaddItem\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eThis functionality is exclusive to Google Chat apps and is not available for Google Workspace Add-ons.\u003c/p\u003e\n"]]],[],null,["# Class UpdatedWidget\n\nUpdatedWidget\n\nThe response of the updated widget. Used to provide autocomplete options for multiselect menu in\n[SelectionInput](/apps-script/reference/card-service/selection-input).\n\n```javascript\nconst updatedWidget = CardService.newUpdatedWidget()\n .addItem(\n 'item_one_title',\n 'item_one_value',\n false,\n 'item_one_uri',\n 'item_one_bottom_text',\n )\n .addItem(\n 'item_two_title',\n 'item_two_value',\n false,\n 'item_two_uri',\n 'item_two_bottom_text',\n );\n```\n\nOnly available for Google Chat apps. Not available for Google Workspace add-ons. \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------------------------------------------------------------|--------------------|---------------------------------------|\n| [addItem(text, value, selected, startIconUri, bottomText)](#addItem(Object,Object,Boolean,Object,Object)) | [UpdatedWidget](#) | Adds a new item that can be selected. |\n\nDetailed documentation\n----------------------\n\n### `add``Item(text, value, selected, startIconUri, bottomText)`\n\nAdds a new item that can be selected.\n\n```javascript\nconst updatedWidget = CardService.newUpdatedWidget()\n .addItem(\n 'item_one_title',\n 'item_one_value',\n false,\n 'item_one_uri',\n 'item_one_bottom_text',\n )\n .addItem(\n 'item_two_title',\n 'item_two_value',\n false,\n 'item_two_uri',\n 'item_two_bottom_text',\n );\n```\nOnly available for Google Chat apps. Not available for Google Workspace add-ons.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `text` | `Object` | The text to be shown for this item. Non-string primitive arguments are converted to strings automatically. |\n| `value` | `Object` | The form input value that is sent via the callback. Non-string primitive arguments are converted to strings automatically. |\n| `selected` | `Boolean` | Whether the item is selected by default. If the selection input only accepts one value (such as for radio buttons or a dropdown menu), only set this field for one item. |\n| `start``Icon``Uri` | `Object` | For multiselect menus, the URL for the icon displayed next to the item's text field. Supports PNG and JPEG files. |\n| `bottom``Text` | `Object` | For multiselect menus, a text description or label that's displayed below the item's text field. |\n\n#### Return\n\n\n[UpdatedWidget](#) --- This object, for chaining."]]