cancel
Showing results for 
Search instead for 
Did you mean: 

EnumMultiReferenceEditor is giving error

abhinavsingh11
Participant
0 Kudos

Hi,

We have a enum DemoEnum for which we want to filter out the values from enum based on condition for which we are using EnumMultiReferenceEditor as follows:

 <editorArea:attribute qualifier="demoStatus" label="customersupport_backoffice_tab_customer_enrollments_label_demoStatus" type="EnumMultiReference-LIST(DemoEnum)" editor="com.hybris.cockpitng.editor.enummultireferenceeditor"/>

However, when I run it , it gives error popup as Improper value type: java.lang.Enum(DemoEnum)'].

I even followed configurations given at:

https://help.hybris.com/1808/hcd/8bab6c4486691014a3899cab8989d996.html

But I cannot get what I am doing wrong. Please help.

mpern
Employee
Employee
0 Kudos

Is the enum generated via items.xml?

abhinavsingh11
Participant
0 Kudos

Yes. This Enum is a dynamic enum generated through items.xml

mpern
Employee
Employee
0 Kudos

try removing the type attribute, the backoffice usually figures this out by itself

abhinavsingh11
Participant
0 Kudos

I even tried without type attribute:

 <editorArea:attribute qualifier="demoStatus" label="customersupport_backoffice_tab_customer_enrollments_label_demoStatus" editor="com.hybris.cockpitng.editor.enummultireferenceeditor"/>


but still getting same error

mpern
Employee
Employee
0 Kudos

What is the type of demoStatus?

abhinavsingh11
Participant
0 Kudos

Type of demoStatus is DemoEnum

former_member682593
Participant
0 Kudos

If the type of demoStatus is DemoEnum, then you cannot use EnumMultiReferenceEditor - as it's not multi reference 🙂 It's single value, and you should follow instructions from my answer below.

Accepted Solutions (0)

Answers (3)

Answers (3)

abhinavsingh11
Participant
0 Kudos

To filter on the values of an enum we can add a editor-parameter "availableValuesProvider" and add a spring bean as it's value

mpern
Employee
Employee
0 Kudos

Type of demoStatus is DemoEnum

How should this ever work? You can not store a collection into a single valued attribute

Change your typesystem ( items.xml) accordingly, preferably add a <relation> with the appropriate cardinality (most likely many-to-many) between DemoEnum and OtherTypeThatShouldHaveListOfDemoEnums

abhinavsingh11
Participant
0 Kudos

,

But how would I filter on a DemoEnum value. DemoEnum is added as a attribute to another item type.

I want to filter showing Enum values based on some condition. how should I achieve this usecase?

mpern
Employee
Employee
0 Kudos

Hm, can you please elaborate a bit further?

  • do you want to filter the values shown in the dropdown?

  • do you want to search OtherTypeThatShouldHaveListOfDemoEnums by DemoEnum?

Unfortunately, I don't really understand your problem / use case

abhinavsingh11
Participant
0 Kudos

Yes. I want to filter the values shown in the dropdown.

former_member682593
Participant
0 Kudos

Try without the 'type' and 'editor' attributes, they are resolved automatically from the type system. Also please add the DemoEnum definition from your *-items.xml

abhinavsingh11
Participant
0 Kudos

Without editor attribute I won't be able to use EnumMultiReferenceEditor. I tried by adding type and without Type.

I already have DemoEnum attribute in my items.xml