Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
360
error in iggridupdatingrowdeleting
posted

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:

$('#gridProducts').on('iggridupdatingrowdeleting', function (evt, ui) {
var tisdelete="0"//no delete
var tstr:string
if (!confirm("Sure you want to delete ?")) {
return false;
}
else
{
var row = ui.owner.grid.findRecordByKey(ui.rowID);
pthis.http.delete("http://10.10.0.56:88/api/SightPurchases/"+ row.SightPurchaseID)
.map(res => res.status)
.subscribe(val => writelog(val)
,
error => {
// handle error
alert ("Error:While Saving Record, Please Contact Administrator: " )
console.error('this an erreor ' + error.status)
return false
/*$("#gridProducts").igGridUpdating("addRow", {SightPurchaseIDTemp: row.SightPurchaseIDTemp, SightPurchaseID: row.SightPurchaseID,SightMonth:row.SightMonth,EntryDate:row.EntryDate,TailleID:row.TailleID,MakeGroupID:row.MakeGroupID,Note:row.Note,ViewParcels:row.ViewParcels});
*/
})//postserviceended
}); //iggridupdatingrowdeleting


Thanks,
yogesh
Parents
No Data
Reply
  • 23953
    Offline posted

    Hello 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.

    Best regards,
    Martin Pavlov
    Infragistics, Inc.

Children