Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

MultiComboBox Set Selected Item by Text Instead of Key

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.

Tags:
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question