Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to delete the data from object

Hi expert,

I'm new to UI5. My requirement is if I click on delete that particular record will delete from table.

So I written my logic according to that,but I struck at one point. I got the particular objects in array which I need to delete but when I use remove keyword the data is not deleting from table. I  Please check the following code

I used the mode to display delete icon in table

In view:

<Table id="table" items="{/items}" mode="Delete" delete="odelete">

Controller:

odelete : function(oEvent) {

  var context = oEvent.getParameter("listItem")

  .getBindingContext().getPath().split("/")[2];

  var obj = this.getView().byId("table").getModel()

  .getData();

  var item = obj.items[context];

  obj.remove(item);

Thanks,

Ashok.

Tags:
replied

ok, if you are using sap.m, the below deletion handler should work for you.

handleDelete: function(evt) {

  evt.getSource().removeItem(evt.getParameter("listItem"));

}

Sreehari

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question