- Home
- Forum
- Angular - EJ 2
- Inline edition how to disable auto save.
Inline edition how to disable auto save.
Hi, I am using the inline edit feature on a grid (angular application v.17), and I noticed that, in edition mode (GridComponent.isEdit = true), any click on a different row than the current one performs eventually a save event as well as clicking outside the grid becomes a cancel. I understand this is the regular behavior but, can the grid be blocked and allow saving or cancelling by clicking only on the appropriate buttons,?.
I tried by adding a listener to the mouseUp event of the grid for unwiring the events when the user clicks on the grid (GridComponent.unwireEvents()) and wire them again when the save or cancel buttons are clicked (GridComponent.wireEvents()) so the click event is not handled and don't raises a saving event, but sometimes if the clicking is faster than the unwire operation, saving is still raised. So, the question is if there is a better way to get this?.
Thanks so much in advance, any help will be appreciated.
isUpdate, as false. Using the actionBegin event of the Grid, we prevent the default save action by setting args.cancel to true when the requestType is save. In the toolbar button click event, we update the boolean variable and call the endEdit method of the Grid to save the data.Code Example : toolbarClick(args: any): void { if (args.item.id === `${this.grid.element.id}_update`) { this.isUpdate = true; this.grid.endEdit(); } } actionBegin(args: any): void { if (args.requestType === 'save') { args.cancel = !this.isUpdate; this.isUpdate = false; // Reset after handling the save operation } } |
thanks so much Sivaranjani,
It helped me so much to fix the problem
Regards,
- 3 Replies
- 2 Participants
- Marked answer
-
JF JoseAn Fed
- Dec 13, 2024 12:38 PM UTC
- Dec 23, 2024 05:26 AM UTC