[MGNLUI-7036] ComboBox field with optionListDatasource doesn't work as filterComponent Created: 17/Feb/22  Updated: 17/Feb/22  Resolved: 17/Feb/22

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.16
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Adam Siska Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File tours.yaml    
Issue Links:
duplicate
duplicates MGNLUI-6364 Column Filter: comboBoxField with opt... Closed
Template:
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
Epic Link: Datasource filtering

 Description   

Steps to reproduce

1. use attached tours.yaml as hotfix for /tours/app/tours.yaml resource
2. open Tours app and select Featured option in comboBox filter

Expected results

Only tours with isFeatured flag are shown in grid

Actual results

Nothing is shown

Workaround

use custom ColumnDefinition class (see Resource app for example) or use enumDatasource with custom enumeration class

Development notes

there are two places where it can be fixed in ui codebase.

option 1) JcrQueryBuilder#withPropertyFilter:

final String value = (filterEntryValue instanceof Node) ? ((Node) filterEntryValue).getIdentifier() :
                       (filterEntryValue instanceof Option) ? ((Option) filterEntryValue).getValue() : filterEntryValue.toString().toLowerCase();

or (cleaner) option 2) provide #toString impl in info.magnolia.ui.datasource.optionlist.Option:

@Override
public String toString() {
  return getValue();
}

Generated at Mon Feb 12 09:42:30 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.