ui.Select
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Menu z możliwością wydrukowania i funkcją oddzwaniania.
Wykorzystanie | Zwroty |
---|
ui.Select(items, placeholder, value, onChange, disabled, style) | ui.Select |
Argument | Typ | Szczegóły |
---|
items | List<Object>, opcjonalnie | Lista opcji do dodania do elementu select. Domyślnie jest to pusta tablica. |
placeholder | Ciąg znaków, opcjonalnie | Zmienna wyświetlana, gdy nie wybrano żadnej wartości. Domyślna wartość to „Wybierz wartość...”. |
value | Ciąg znaków, opcjonalnie | Wartość elementu select. Domyślna wartość to null. |
onChange | Funkcja (opcjonalnie) | Funkcja zwrotna, która ma zostać wywołana po wybraniu elementu. Wywołanie zwrotne otrzymuje obecnie wybraną wartość i widget wyboru. |
disabled | Wartość logiczna, opcjonalna | Określa, czy możliwość wyboru jest wyłączona. Wartość domyślna to fałsz. |
style | Obiekt (opcjonalnie) | Obiekt dozwolonych stylów CSS z wartościami, które mają być ustawione dla tego widżetu. Zobacz dokumentację funkcji style(). |
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 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. |"]]