Skip to content

Conversation

@RoboErikG
Copy link
Contributor

The basics

The details

Resolves

Fixes #1288

Proposed Changes

Adds a setOptions function to field_dropdown to allow changing the set of options or the generator for options after creation.

Reason for Changes

This makes it easier to define blocks with dynamic dropdowns in JSON.

Test Coverage

Added a test to verify the selected option is updated after changing the set of options.

Documentation

We should consider updating the dropdown field docs to include this as a simpler option for the JSON definitions.

Additional Information

@RoboErikG RoboErikG added the PR: feature Adds a feature label Mar 31, 2025
@RoboErikG RoboErikG requested a review from a team as a code owner March 31, 2025 17:35
@RoboErikG RoboErikG requested a review from BenHenning March 31, 2025 17:35
Copy link
Collaborator

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @RoboErikG! Had some thoughts and suggestions, PTAL.

@BenHenning BenHenning assigned RoboErikG and unassigned BenHenning Mar 31, 2025
@RoboErikG RoboErikG assigned BenHenning and unassigned RoboErikG Apr 1, 2025
Copy link
Collaborator

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM @RoboErikG!

@BenHenning BenHenning assigned RoboErikG and unassigned BenHenning Apr 3, 2025
@RoboErikG RoboErikG merged commit a2d7621 into RaspberryPiFoundation:develop Apr 17, 2025
7 checks passed
@RoboErikG RoboErikG deleted the dropdown-options branch June 23, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: feature Adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create an API for setting menuGenerator_ on field_dropdown after creation

2 participants