cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5: How to save the Selections of a Table(Model) to the backend

former_member614481
Participant
0 Kudos

Hello,

I do have the following Model:

function getExample(){
  	var model = {
         "Model":[0:{"Title":"First", "Option":["Yes","No","Unknown"]},
      		  1:{"Title":"Second", "Option":["Yes","No","Unknown"]},
                  2:{"Title":"Third", "Option":["Yes","No","Unknown"]}]
	}
	return model;
  }

var oModelExample = new sap.ui.model.json.JSONModel();
this.setModel(oModelExample, "modelExample")
oModelExample.setData(getExample().Model)

That is bound to the View, and delievers the following Table:

Question: Users are going to choose one of the Options :Yes/No/Unknown.

1. What it is the very best way to save the selected Option to the Backend, so that later this result can be showcased ?

2. Does .getModel() deliever Model with it selected Options ?

Accepted Solutions (0)

Answers (1)

Answers (1)

boghyon
Product and Topic Expert
Product and Topic Expert

JSONModel is a client-side model. It's not aware of and doesn't care about backend. If you have an OData service, v2/v4.ODataModel should be used.

Use the ODataModel together with TwoWay data binding. If the user changes something via the UI, the model will register the change automatically. From there, you can send the change to the backend directly with .submitChanges().