Skip to Content
Jul 28, 2019 at 10:15 AM

SAPUI5 Select control not saving data to OData model

342 Views Last edit Jul 28, 2019 at 10:16 AM 3 rev

I have created a full-stack app in Web IDE. I created:

  • HANA table using CDS in data-model.cds.
  • Java-based service that is running.
  • SAPUI5 table that displays the rows and allows editing of multiple rows, then a user pushes Save and it saves all rows by calling submitChanges on the data model

All is OK, except I have now added a column to the table that users a Select control. Here is the XML code:

   items="{ path: 'actions>/Actions' }">
       <c:Item key="{actions>key}" text="{actions>label}"/>

And here is the controller code.

initActions: function () {
	var actions = {"Actions" : [
		{key: 0, label: ""},
		{key: 1, label: "Keep"},
		{key: 2, label: "Migrate"},
		{key: 3, label: "Delete"}

	var oModel = new sap.ui.model.json.JSONModel(actions);
	this.getView().setModel(oModel, "actions");

When I view the data, and if I change the data directly in the database, I get the right values in the Select box. But if I change the select box and click Save, it does not save the values (in fact, at this point, it doesn;t save any of the data).

I have a default data model (OData data source), whose field is status. The second model holds the choices for the Select control.

Any idea?