Stay organized with collections
Save and categorize content based on your preferences.
blockly > FieldDropdown > getOptions
FieldDropdown.getOptions() method
Return a list of the options for this dropdown.
Signature:
getOptions(useCache?: boolean): MenuOption[];
Parameters
Parameter |
Type |
Description |
useCache |
boolean |
(Optional) For dynamic options, whether or not to use the cached options or to re-generate them. |
Returns:
MenuOption[]
A non-empty array of option tuples: (human-readable text or image, language-neutral name).
Exceptions
{TypeError} If generated options are incorrectly structured.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["`getOptions()` retrieves the list of options available in the dropdown field."],["Options are returned as an array of `MenuOption` tuples, each containing display text/image and a language-neutral name."],["The `useCache` parameter (optional, defaulting to true) determines whether to use cached options or regenerate them for dynamic content."],["Incorrectly structured options may result in a `TypeError`."]]],["The `FieldDropdown.getOptions()` method retrieves the dropdown's options, returning a non-empty array of `MenuOption` tuples. These tuples contain human-readable text or images and corresponding language-neutral names. An optional `useCache` parameter determines whether to use cached options or regenerate them for dynamic dropdowns. The method may raise a `TypeError` if the generated options are improperly formatted.\n"]]