Skip to Content

How to delete record from oData and not from backend server.

Feb 12 at 06:11 PM


avatar image


My application is to change address. There are two views in my application. First view is to provide employee#. Once Employee# is entered and click on edit button.. it will give us second view to change address. While coming back I want to remove record from oData (not from backend server). how to remove record from oData?app01.jpg

Please help me..

Thank you,

Balaji P.

app01.jpg (29.7 kB)
10 |10000 characters needed characters left characters exceeded

I don't understand your question. In the first screen, you have an input field to enter the Emp#, and then you navigate to the address modification form. After changing the data, you comeback to the first screen, and then what ? Which record do you want to delete ?


Sorry for the late response.

Step1: I entered Empl#1 on first screen and then click on GO.. it will go to second screen. (in this scenario no need to change data)

Step2: Come back to First screen and enter Empl#2 and click on GO. it will display address of Empl#2.

Step3: if we debugg now.. it is showing records of both employees.

When we navigate back to first screen, I need to remove record of current employee. how to remove the ercord from oModel.oData?

* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Arjun Biswas Feb 13 at 05:07 AM

Hi Balaji Peethani,

The gModel.getData() would return you an array of the data objects. You can use array methods like delete or splice to remove your required row and set the resulting array into another JSON model maybe.

var dat = gModel.getData();
dat.delete[index of the required row]; // after this set dat to an JSON model.

Hope this helps,


Arjun Biswas

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Arjun,

I tried to use the same code. But it didn't work. it is showing dat as null. Model has data.

app03.jpg => dat

app02.jpg => data from gModel

app02.jpg (54.1 kB)
app03.jpg (23.6 kB)

I am bale to get record from gModel to dat. I tried dat.delete[1] now. it is raising error.

dat =

  1. Areac:"000"
  2. Begda:Sat Feb 03 2018 16:00:00 GMT-0800 (Pacific Standard Time) {}
  3. Endda:Thu Dec 30 9999 16:00:00 GMT-0800 (Pacific Standard Time) {}
  4. Inits:"M."
  5. Land1:"US"
  6. Message:""

Hi Arjun,

Your suggestion is helpful for me to read each context of entity set.

I used the below statements is working. oModel is not retaining any history(previous employees information on the same session).

this.getView().getModel().oData = {}; 
this.getView().getModel().mContexts = {};