ui.Select
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เมนูที่เลือกได้ซึ่งพิมพ์ได้พร้อมการเรียกกลับ
การใช้งาน | การคืนสินค้า |
---|
ui.Select(items, placeholder, value, onChange, disabled, style) | ui.Select |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
items | List<Object> (ไม่บังคับ) | รายการตัวเลือกที่จะเพิ่มลงในช่องเลือก ค่าเริ่มต้นจะเป็นอาร์เรย์ที่ว่างเปล่า |
placeholder | สตริง ไม่บังคับ | ตัวยึดตำแหน่งที่แสดงเมื่อไม่ได้เลือกค่า ค่าเริ่มต้นคือ "เลือกค่า..." |
value | สตริง ไม่บังคับ | ค่าของตัวเลือก ค่าเริ่มต้นคือ null |
onChange | ฟังก์ชัน (ไม่บังคับ) | การเรียกกลับที่จะเรียกใช้เมื่อมีการเลือกรายการ ระบบจะส่งค่าที่เลือกในปัจจุบันและวิดเจ็ตการเลือกไปยังการเรียกกลับ |
disabled | บูลีน ไม่บังคับ | ปิดใช้การเลือกหรือไม่ ค่าเริ่มต้นคือ false |
style | ออบเจ็กต์ (ไม่บังคับ) | ออบเจ็กต์ของสไตล์ CSS ที่อนุญาตพร้อมค่าที่จะตั้งค่าสำหรับวิดเจ็ตนี้ ดูเอกสารประกอบเกี่ยวกับ style() |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eCreate a customizable select menu with \u003ccode\u003eui.Select()\u003c/code\u003e by providing items, placeholder, initial value, and styles.\u003c/p\u003e\n"],["\u003cp\u003eDefine an \u003ccode\u003eonChange\u003c/code\u003e callback function to execute actions when a user selects an item from the menu, receiving the selected value and the select widget.\u003c/p\u003e\n"],["\u003cp\u003eUtilize optional parameters like \u003ccode\u003edisabled\u003c/code\u003e to control interactivity and \u003ccode\u003estyle\u003c/code\u003e to modify the appearance of the select menu.\u003c/p\u003e\n"]]],[],null,["# ui.Select\n\n\u003cbr /\u003e\n\nA printable select menu with a callback.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------------------------------------------------------------------------|-----------|\n| `ui.Select(`*items* `, `*placeholder* `, `*value* `, `*onChange* `, `*disabled* `, `*style*`)` | ui.Select |\n\n| Argument | Type | Details |\n|---------------|--------------------------|---------------------------------------------------------------------------------------------------------------------------|\n| `items` | List\\\u003cObject\\\u003e, optional | The list of options to add to the select. Defaults to an empty array. |\n| `placeholder` | String, optional | The placeholder shown when no value is selected. Defaults to \"Select a value...\". |\n| `value` | String, optional | The select's value. Defaults to null. |\n| `onChange` | Function, optional | The callback to fire when an item is selected. The callback is passed the currently selected value and the select widget. |\n| `disabled` | Boolean, optional | Whether the select is disabled. Defaults to false. |\n| `style` | Object, optional | An object of allowed CSS styles with their values to be set for this widget. See style() documentation. |"]]