cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5: Get modified values from UI. The concept was driven using oData

JuliusRelacion
Participant
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

JuliusRelacion
Participant
0 Kudos

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");
Former Member
0 Kudos

If you are using oData It should refresh.

JuliusRelacion
Participant
0 Kudos

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.

JuliusRelacion
Participant
0 Kudos

in order for us to visualize. Kindly see screen shot below. Thank you in advance. I believe you have stack knowledge mate. 😄