Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIO-8091: added selectData calculation for url/resource select components #5564

Merged
merged 2 commits into from
Apr 16, 2024

Conversation

roma-formio
Copy link
Contributor

@roma-formio roma-formio commented Apr 12, 2024

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-8091

Description

The issue: possible select component configuration: URL/Resource data source, lazy loading, value property and item template (using different properties from request object), default value. With this configuration in the form definition, we can see only value property for default value. So select component will be not aware of other object properties unless click on the select component to load items.
The solution: add selectData property for select component definition so select component can use required data for template without loading items.

The first iteration: I tried to use just conditional and calculated value for the selectData field but faced a problem when we change the template and click on default value to load items, as a result, calculate will not be triggered because the default value will not be changed.
Second iteration: when we click on the default value field, we're loading all items, and the onSetItem method will be called so we can use it to update the selectData property and do the same when we select other default values using the onChange method. Set selectData with all additional fields that the select component needs using a template and loaded data.

How has this PR been tested?

Unit tests

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@TanyaGashtold TanyaGashtold merged commit f7c8ef3 into master Apr 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants