on 03-06-2019 11:00 AM
Hello Folks,
I am using V2 ODataModel with Two-Way binding for my sap.m.Table. Table contains one editable column.
So whatever edited that data to be updated to back-end system. but the catch is after editing the items I am not updating. though I am not updating Model is holding the changed values not from the server. To understand the issue we troubleshooted it. What we found is, since we are using Two-Way binding, model is holding the changed Entities.
Could you please guide us, how can I nullify the Changed Entities array from Model.
Thanks in Advance.
Best Regards, Kiran.
oModel.resetChanges([this._sEntity]);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you jberthe.
Yes correct, As Mahesh said "this.getView().byId("idTab").getModel().resetChanges();" this is working for me but I want exact path.
maheshkumar.palavalli as per your given snippet what exactly I should give in the "sPath1"
I am trying as below, but its not working as I expected.
xPath1 = "/entityset". what shall I replace with "1". What is the meaning of '1'.
Here is my expectation,
I have OData V2 model with Two way binding. And in that 3 entitysets are there all 3 are get_entity_sets only. out of 3, 1 I am using for edit. I want reset the changes of that particular 1 entityset not for all.
Thanks in Advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kiran VK,
Please check my comment once.. "1" means path. Path is a regular odata path.. eg. If my entiyname is "Customers" and customer id is "AFKJ" the path will be /Customers(id='AFKJ').
You can google or go through the sap ui5 documentations, tutorials or odata related tutorials for this as it is a basic one.
BR,
Mahesh
Hi Kiran VK,
If I understand you correctly, you want to clear out all the changes that you performed in the odata model data, if yes use the below method.
https://ui5.sap.com/#/api/sap.ui.model.odata.v2.ODataModel/methods/resetChanges
BR
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Mahesh.
after adding below piece of code I am able to clear the changed entities from Model.
this.getView().byId("idTab").getModel().resetChanges();
But I am unable to figure it out how to pass the sPath as a Array for resetChanges method.
If you have any ide about this kindly help me.
Hi Kiran VK
it should be as below.
// sPath1 = "/entitySet(1)";
aPaths = [sPath1, sPath2];
resetChanges(aPaths)
BR,
Mahesh
Joseph BERTHE It seems that the code you mentioned already worked for him.. I think Kiran VK wants to clear specific paths.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.