Skip to Content

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


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)
Add comment
10|10000 characters needed 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?

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 13, 2018 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

    Add comment
    10|10000 characters needed characters exceeded

    • 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 = {};