Hi,
I am using iggrid in my Angular 2 project,there is something wrong i have written in iggridupdatingrowdeleting
we are using webapi as our backend, the problem i am facing is row get deleted before i have receive error notification from Webapi,in this case record exists in DB but not in Grid , but once i refresh grid record get back again.
even i have written return false in my catch section but still row get deleted. (autoCommit: true in my grid)
following is the code:
Hello Yogesh,
The following Plnkr sample demonstrates how to handle remote row deleting: https://plnkr.co/edit/kJVlYy75rDWHT91YRs4j?p=preview
The sample uses the igGridUpdating.deleteRow to manually delete a row after the server returns status code OK 200.
To try the sample:
Try to delete row 1 and it will delete.
Try to delete row 2 and it won't delete.
You'll have to implement a notification mechanism while the remote request is processed.
P.S.: The rollback approach didn't work as I expected so use the above approach.
Best regards,Martin PavlovInfragistics, Inc.
Hi Martin,
Thanks for Reply
I have tried Option 1, but there is not luck. please check my below code .
also attach Screenshot
Can you please share sample for option 2
Thanks,
Yogesh
You're making and async call to the server in 'iggridupdatingrowdeleting' event, so what you see is expected (the row gets immediately deleted in the grid). Unless you return false in the event handler itself the deleting of the row won't be cancelled.
Your options are:
1. In the error handler of the "delete" request you can use the igGrid.rollback API to undo deleted row.
2. Cancel 'iggridupdatingrowdeleting' event and in the success handler of the "delete" request call the igGridUpdating.deleteRow API to manually delete the row once you're sure it's deleted on the server.