Hi Team,
I am facing the below issue while editing a cell and discard the changes. I have edited a cell and without saving clicked on Discard changes. We will be able to see the old value but if i click on the cell, discarded value is populated. I could reproduce this issue in igx-grid sample stackblitz. I could see the cell.editValue is having discarded value and is populated onEdit. Kindly let me know the fix for this issue.
Please find the steps to reproduce the issue.
Stackblitz - https://stackblitz.com/edit/angular-ijtpog
Thanks,
Vijay V
Hello Vijay,
Thank you for posting into our community!
I have been looking into your question and after an investigation I have determined that this behavior is due to the built-in validation service that sets the last edit value for the cell. Additionally, I have noticed that when “discarding the changes” you are setting the data property of the IgxGrid rather than updating/reverting the applied changes and as mentioned in our Validation triggers section here, validation will not trigger for records that have not been edited via user input or via the editing API, thus when entering edit mode for the same cell it displays the previous edit value.
Having this in mind, an approach I could suggest is using the IgxGridValidationService clear method after setting the data.
This could look similar to the following:
public setData() { this.grid.data = DATA2; this.grid.validation.clear(); }
Here could be found a small sample demonstrating this approach.
Additionally, if you require a functionality where the applied changes could be discarded, I recommend using batch editing as it allows every single modification of each cell to be preserved separately and undo/redo operations are available on cell level. More detailed information along with code snippets and samples could be found in our Batch Editing and Transactions topic here.
Please let me know if you need any further assistance regarding this matter.
Looking forward to your reply.
Sincerely,Riva IvanovaAssociate Software Developer
Hi,
In Angular 9 it is working fine but once we upgraded to Angular 14 we are facing this issue. We are using paid package "@infragistics/igniteui-angular": "^14.2.17" version. Based on our requirement we are not preferring batch edit. Kindly let us know if this issue will be addressed in future.