on 12-05-2017 6:44 AM
Currently i was doing SAPUI5 a self study. I used SAPUI5 Explored as reference and replicate the functionality in HanahStudio using the mockdata. But, there was an issue encountered when implementing it using ODATA in edit mode. I can not get the modified data in the UI table as the front end system will always triggered the back end and repopulate everything.
Failed steps:
(a) I also do the debugging to check if the modification has been carry over to back end and there were none.
(b) Check also the values before and after triggering the back end. The result was getting the old data.
CODING MADE IN HANAH STUDIO
CONTROLLER
INITIALIZATION FUNCTION:
this.oModel = new sap.ui.model.odata.ODataModel(url);
this.getView().setModel(this.oModel);
this.oTable = this.getView().byId("idProductsTable");
ONSAVE FUNCTION
* CHECK table value before triggering the ODAta
RESULT Still i can not get the modified data.
var oTable = this.getView().byId("idProductsTable");
var aModel = oTable.getModel();
var oData = aModel.oData;
console.log(oData);
*TRIGGERING THE BACK END
this.rebindTable(this.oReadOnlyTemplate, "Navigation");
VIEW
<Table id="idProductsTable" growing="true" growingThreshold="10" mode="MultiSelect">
Questions
1. How can we retrieve the changes in the UI table? Any suggestion and recommendation on how to retrieved the modified data.
Thank you in advance.
Hi Choco Relacion,
Could you refresh your model data after your update function has been executed in your back end OData. Use the foll. code :
your_model_object.refresh(true);
Hope this helps,
Regards,
Soumya M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi soumya.m, Thank you for your response. The modification i made in the UI was reset to its original value and did not achieved our goal in retrieving the modified data.
// to check if we can get the changes in the UI view.
this.oModel.refresh(true); // suggested code <----
var oTable = this.getView().byId("idProductsTable");
var aModel = oTable.getModel();
var aItems = oTable.getItems();
var oData = aModel.oData;
console.log(oData);
///
this.rebindTable(this.oReadOnlyTemplate, "Navigation");
Hi soumya.m , good day. Yes you are correct the data was refreshed. But the issue I encountered is to retrieved modified entries from UI view. Currently i was not getting it. 😞 hoping you have codes that will get the modified values. I also tried getCore().values it was deprecated. 😞
Btw, appreciate your help. 🙂 Thank you.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.