cancel
Showing results for 
Search instead for 
Did you mean: 

Context delete Not refreshing in table - SAP UI5 - OData V4

codebrokerad
Participant
0 Kudos

I am working on table, where i add new records through the table by creating a context. This record does not exists in the backend and is only active in the client. I am deleting the context using the method context.delete(). After executing this method if i check the method context.isDeleted(). I get the response true. However the table is still displaying the items. How do i remove the item from the table. In the API documentation as listed down, it is mentioned the bindings are immediately updated.

Deletes the OData entity this context points to. The context is removed from the binding immediately, even if sap.ui.model.odata.v4.SubmitMode.API is used, and the request is only sent later when
But for me the table still has the records. 
Following is my code.  
Table Binding:
items="{ path: 'model>/APPROVERS', filters: [ { path: 'REQ_ID' , operator: 'EQ', value1: 'null' }], parameters: { $$groupId: 'ApprovalCreate',$$updateGroupId: 'ApprovalUpdate'} }"

For creating new Context: this.listBinding.create(); For deleting the context. var oSelectedItem = this.getView().byId("idTable").getSelectedItem(); var oContext = oSelectedItem.getBindingContext("model"); oContext.requestObject().then(() => { oContext.delete(); }) Next time i try to delete the same item, i get the message "Must not delete twice". My requirement is after the item context is deleted i wanted it to disappear from the table.

Accepted Solutions (0)

Answers (1)

Answers (1)

Marian_Zeis
Active Contributor

How about a simple

this.listBinding.refresh()

when the context is deleted?