Hi,
Currenly,i am facing following issue:
1) for insert,update,delete:
we are using WEBAPI in our project, if any error occurs while making Insert,Update,Delete, WebApi Returning that Error string. but currently if any error occures at webapi , Igrrid still insert,update,delete that respective record into the grid .
with help of Error string, how can i restrict iggrid to
a).add new row with that record,
b).update existing record,
c).delete record
2). i am using ('iggridupdatingeditrowended', function (evt, ui){} for update, but if i have click on cell for edit and click on cancel button without editing any field, still ('iggridupdatingeditrowended', function (evt, ui){} event get fired , it should get fire only when i would click on Done button.
Thanks,
Yogesh
Hello Yogesh,
Regarding error handling with WebAPI, the answer may depend on how you have set your restSettings and at which point you call saveChanges but in general, you will want to disable auto-committing (autoCommit: false) then call saveChanges with both a success and an error callback. In the success callback you should call a manual commit so that the change gets persisted in the local data source. In the error callback you should rollback the faulty edit.
By design the editRowEnded event gets fired when editing for a row ends, regardless of the result. Should you want to detect if the end-user wanted to persist the change (by clicking the Done button or hitting Enter) or not (Cancel/Esc) you should use the event argument "update" as listed in the API reference.
I hope this helps! Thank you for using Infragistics forums!
Please, let me know if you have any other questions or concerns!
Best regards,
Stamen Stoychev
Hi Stamen,
Thanks for Reply.
On my code Autcommit is true , if the error occurs at webApi ,it return ERROR in string, but grid still showing me that record with Primary key ID=-1 because i have set defaultvalue -1 for primarykey, but when i reload the page that row is disappearing, that means its not get committed in Datasource.
how i can restrict iggrid for adding row with primary ID=-1.
Please check below attached Screenshot
yogesh