Skip to Content

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

How to set dropdown selected keys with values from another model?

New to UI5 and attempting to create a table with rows bound to an OData model. One of the columns will be an editable dropdown with list elements populated via a JSON model. How can one bind the dropdown list to the JSON model, but set the selected key to values from the OData table?

I was able to get this working when both the table and dropdown were paths within the same OData model, but the browser was calling the OData service to get the dropdown list for every row in the table so I am now binding the list to a JSON model.

A rough example of what isn't working for me is below. I was assuming this was a matter of using named models and getting the right path syntax, but no luck so far:

var oModel_YN = new sap.ui.model.json.JSONModel();

oModel_YN.setData([{key: "Y", text: "Yes"}, {key: "N", text: "No"}]);

var oDropYN = new sap.ui.commons.DropdownBox({

  change: oController.updateService


oDropYN.bindItems('MyYN>/', new sap.ui.core.ListItem({key: '{MyYN>key}', text: '{MyYN>text}'}));

oDropYN.setModel(oModel_YN, "MyYN");

oDropYN.bindProperty("selectedKey", "{YN}");

this.oModel = new sap.ui.model.odata.ODataModel("/data/myservice.xsodata", true); // model contains a field YN which should be used for the list element selection

oTable = new sap.ui.table.Table("updateTable", {tableId: "updateTableId", visibleRowCount: 10});



oTable.addColumn(new sap.ui.table.Column({

     label: new sap.ui.commons.Label({text: "Yes/No}),

     template: oDropYN,





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