cancel
Showing results for 
Search instead for 
Did you mean: 

MultiComboBox Set Selected Item by Text Instead of Key

Abdul_Waheed
Contributor
0 Kudos

Hi all,

I am quite new to UI5,

I have a developed

  • 4 drop downs,  mix of sap.m.ComboBoxes and sap.m.MultiComboBoxes.
  • Integrated them with Odata services
  • Based on item selected in first drop down, the underneath drop down will be mapped with new Odata
  • All items are mapped with keys which are consumed from Odata service
  • I am able to save it in the backend
  • Everything works fine

The problem is the final bottom sap.m.MultiComboBox drop down doesn't have keys mapped from the Odata service, so keys are empty.

So, I am saving selected item text in the back end.

Now I would like to know if i can make an Multicombo box item selected using Text instead of Key ?

I have gone through all methods, it has methods to make an item selected using Key only.

Please guide me. Below Sap.m.MultiComboBox methods are not helping me.

addSelectedItem(oItem) Adds some item oItem to the association named selectedItems.

addSelectedKeys(aKeys) Adds selected items.

setSelectedItems(aItems) Setter for association selectedItems.

setSelectedKeys(sSelectedKeys) Setter for property selectedKeys.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

i am kind of lost what exactly is the problem?

https://openui5.hana.ondemand.com/docs/api/symbols/sap.ui.core.Item.html

sap.ui.core.Item has text and key , if there is no key, bind key with the same value as text

Abdul_Waheed
Contributor
0 Kudos

Maksim, Thanks for sharing idea of using text value as KEY. This will help.

Answers (0)