[MGNLUI-2427] Select field options not updated when datasource changes Created: 19/Nov/13 Updated: 25/Jan/17 Resolved: 16/Nov/15 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | app framework, forms |
| Affects Version/s: | 5.3.11 |
| Fix Version/s: | 5.3.12, 5.4.4 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Marek Swiecznik | Assignee: | Ngoc Nguyenthanh |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | quickwin, support | ||
| Remaining Estimate: | 2.5h | ||
| Time Spent: | 1d 5.5h | ||
| Original Estimate: | 2d | ||
| Issue Links: |
|
||||||||||||||||
| Template: |
|
||||||||||||||||
| Patch included: |
Yes
|
||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||||||
| Date of First Response: | |||||||||||||||||
| Sprint: | Basel 19 | ||||||||||||||||
| Story Points: | 2 | ||||||||||||||||
| Description |
|
Steps to reproduce:
Expected behavour: Where is this bug/How to fix? Patch: SelectFieldFactory.java diff --git a/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/factory/SelectFieldFactory.java b/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/factory/SelectFieldFactory.java index ecd1ed4..a123c0c 100644 --- a/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/factory/SelectFieldFactory.java +++ b/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/factory/SelectFieldFactory.java @@ -159,7 +159,10 @@ public class SelectFieldFactory<D extends SelectFieldDefinition> extends Abstrac public List<SelectFieldOptionDefinition> getSelectFieldOptionDefinition() { List<SelectFieldOptionDefinition> res = new ArrayList<SelectFieldOptionDefinition>(); - if (definition.getOptions() != null && !definition.getOptions().isEmpty()) { + if (StringUtils.isNotBlank(definition.getPath())) { + // Build an option based on the referred node. + buildRemoteOptions(res); + } else if (definition.getOptions() != null && !definition.getOptions().isEmpty()) { for (SelectFieldOptionDefinition option : definition.getOptions()) { option.setValue(getValue(option)); option.setLabel(getMessage(getLabel(option))); @@ -171,9 +174,6 @@ public class SelectFieldFactory<D extends SelectFieldDefinition> extends Abstrac } res.add(option); } - } else if (StringUtils.isNotBlank(definition.getPath())) { - // Build an option based on the referred node. - buildRemoteOptions(res); } return res; |
| Comments |
| Comment by Ngoc Nguyenthanh [ 16/Nov/15 ] |
|
As current implementation of Select Field in info.magnolia.ui.form.field.factory.SelectFieldFactory#getSelectFieldOptionDefinition. It will check defined options in the field definition first. If the field options are empty or undefined then remote options will be applied. Vice versa it will use defined options without taking care of the 'path' property. Path to an existing option set as opposed to defining options in the current definition. I fixed by apply the patch. So if the 'path' property is set, then existed options of the field will be overridden by remote options. |
| Comment by Aleksandr Pchelintcev [ 20/Nov/15 ] |
|
Copied from the Pull-request conversation: After some further discussion, investigation and through reading of the issue statement - it appears that the patch actually only incidentally fixes the consequence, but not the problem itself:
|