cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamically populating a dropdown menu in a create-wizard

0 Kudos
1,145

I am currently trying to configure a create wizard for a custom item type. One of the fields (attribute) of the object is a string value. So in this case in the create wizard editor it renders a normal text box for input. This is expected as the data type is just a string.

BUT rather than providing a textbox for input is there anyway to replace the textbox with a drop down menu with option values? I would also need to populate the options for the menu dynamically (they will differ for each item).

This is for the PCM Backoffice (Hybris 6.7)

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

One solution is to create your own editor, rendering either a textbox or a dropdown. Than you use this editor within wizard-configuration:

 ..
                         <wz:property qualifier="myField" type="java.lang.String" editor="de.mycompany.backoffice.editors.myeditor">
                             <wz:editor-parameter>
                                 <wz:name>attribute</wz:name>
                                 <wz:value>{parentObject.attribute}</wz:value>
                             </wz:editor-parameter>
                         </wz:property> ..





0 Kudos

Thanks . I think this should work. I am currently facing issue trying to retrieve the value from within the editor class.

I am trying to get the value from usng a method I created (which returns the string value) using EditorContext as such:

 final Object productCode = context.getParameterAs(PARAM_CODE);
 if(productCode instanceof String)
 {
 return (String) productCode;
 }

But I am not getting the actual value of the parent object but rather the value defined in the configuration. {parentObject.code}

Maybe I need to reference it differently in configuration OR I'm obtaining it incorrectly in editor class?

Former Member
0 Kudos

did you try it with <wz:value>{parentObject}</wz:value>?

Alternatively you can always pass the pk of the parentObject and instantiate the object with it. But this is a little bit ugly.