on 10-18-2016 4:57 PM
Hello dear experts,
i'm new in fiori/ sapui5 and i'm working now on a fiori project. i use a worklist template for that. On both pages i have actions(approve and reject.. most act identically on both pages). These Buttons trigger a change in my data and call an update function(crud) to also change the odata in the backend. I use for that ajax, this work pretty fine on the List page. But make trouble in the object/detail page.
Here i perform an update in my backend (Worklist.js) / Worklist page
var batchChanges = [];
var oUpdateModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/Z_XNEU_SRV/");
jQuery.ajax({
// Data request
type: "GET",
contentType: "application/json",
url: "/sap/opu/odata/sap/Z_XNEU_SRV/",
dataType: "json",
async: false,
success: function() {
for (i = 0; i < aSelectedItem.length; i++) {
// Change Datafield in oUpdateModel
//...
//perform batch operation for backend (PUT)
batchChanges.push(oUpdateModel.createBatch Operation(
sPath,
"PUT",
oContractObject));
}
// refresh odata
oUpdateModel.addBatchChangeOperations(batchChanges);
oUpdateModel.submitBatch(function(data) {
oUpdateModel.refresh();
}
and here the update in object.js (object page)
var batchChange = [];
var oUpModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/Z_XNEU_SRV/");
jQuery.ajax({
// Data request
type: "GET",
contentType: "application/json",
url: "/sap/opu/odata/sap/Z_XNEU_SRV/",
dataType: "json",
async: false,
success: function() {
oContractObject = oView.getBindingContext().getObject();
// Change Datafield in oUpModel
//...
//perform batch operation for backend (PUT)
batchChange.push(oUpModel.createBatchOperation(
sPatch,
"PUT",
oContractObject));
oUpModel.addBatchChangeOperations(batchChange);
oUpModel.submitBatch(function(data) {
oUpModel.refresh();
});
}
});
in the object page there is just one object selected, so i don't need a loop when i perform the changes. The "sPatch" and "oContractObject" are filled correctly but the "PUT"-operation don't work for the Object page. Please i need help. Don't understand why..
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.