cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5: How to generate new Elements based on a ComboBox Option

former_member614481
Participant
0 Kudos

Hello,

I have the following ComboBox:

<ComboBox items="List with items" width="100%" visible="true" 
textAlign="Initial" textDirection="Inherit" maxWidth="100%">
  <items>
    <core:Item text="Example 1">
      <Label text="Option 1"></Label>
      <Label text="Option 2"></Label>
   </core:Item>
   <core:Item text="Example 2">
   </core:Item>
  </items>
</ComboBox>

I have a comboBox with two Possibilities Example 1, Example 2.

If the User chooses Example 1 -> the Label Text of Option 1 and 2 should drop.

I get the following Error:

What to do to make it function?

Accepted Solutions (0)

Answers (2)

Answers (2)

Joseph_BERTHE
Active Contributor

Hi,

I don't understand what you want to do? Adding Label inside a core:Item is not part of aggregation (cf your error), here what you can set inside Item : https://ui5.sap.com/#/api/sap.ui.core.Item%23aggregations

Here is the Guidelines which show you how a Combobox should work : https://experience.sap.com/fiori-design-web/combo-box/

Regards,

Joseph

former_member614481
Participant
0 Kudos

I want by clicking "Example 1 " for a Label with the text to pop into existance. Like a dropdown in a drop down menu

maheshpalavalli
Active Contributor
0 Kudos

you cannot do it using two combo box for sure, use two different combo boxes and on the first combo box value change, update the items of the second combo box using json model binding dynamically instead of hardcoding.

Thanks,

Mahesh