ui.Select.onChange
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Rejestruje wywołanie zwrotne, które jest wywoływane po wybraniu elementu.
Zwraca identyfikator, który można przekazać do funkcji unlisten(), aby wyrejestrować wywołanie zwrotne.
Wykorzystanie | Zwroty |
---|
Select.onChange(callback) | Ciąg znaków |
Argument | Typ | Szczegóły |
---|
to: ui.select | ui.Select | Instancja ui.Select. |
callback | Funkcja | Funkcja zwrotna, która ma zostać wywołana po wybraniu elementu. Wywołanie zwrotne otrzymuje obecnie wybraną wartość i widget wyboru. |
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-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[[["\u003cp\u003eRegisters a callback function that is triggered when a user selects an item in the ui.Select component.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eonChange()\u003c/code\u003e returns a unique ID that can be used to unregister the callback function using \u003ccode\u003eunlisten()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe callback function receives the currently selected value and the ui.Select widget as arguments.\u003c/p\u003e\n"]]],["`onChange` registers a callback function that triggers upon item selection. This function receives the selected value and the `ui.Select` instance as arguments. The method returns a unique string ID. This ID is crucial for later removing the callback using the `unlisten()` function. The `ui.Select` instance is accessible within the callback through the 'this' keyword.\n"],null,["# ui.Select.onChange\n\n\u003cbr /\u003e\n\nRegisters a callback that's fired when an item is selected.\n\n\u003cbr /\u003e\n\nReturns an ID which can be passed to unlisten() to unregister the callback.\n\n| Usage | Returns |\n|-----------------------------|---------|\n| Select.onChange`(callback)` | String |\n\n| Argument | Type | Details |\n|-------------------|-----------|---------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.select` | ui.Select | The ui.Select instance. |\n| `callback` | Function | The callback to fire when an item is selected. The callback is passed the currently selected value and the select widget. |"]]