HI,
I'm a bit confused about the behaviour of the JSON model.
From what I understand from the AP documentationI, I would expect that
var xModel = new sap.ui.model.json.JSONModel("https://PATH_TO_REST_SERVICE");
var oParameters = {
"Name": sap.ui.getCore().byId('txt_name').getValue(),
};
xModel.setData(oParameters);
sap.ui.getCore().setModel(xModel);
should do the same like
var xModel = new sap.ui.model.json.JSONModel();
var oParameters = {
"Name": sap.ui.getCore().byId('txt_name').getValue(),
};
xModel.loadData("https://PATH_TO_REST_SERVICE", oParameters, true, "GET")
sap.ui.getCore().setModel(xModel);
which is sending the data in JSON format to the Server via GET.
But unfortunatelly, the first way does not work, the oParameters value is not being sent to the REST Service.
The second way works well.
What am I doing wrong?