on 06-17-2023 10:33 AM
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.
How about a simple
this.listBinding.refresh()
when the context is deleted?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.