does not update when click out side

Hi. When I'm in edit mode, if I click on another row, the row being edited will be updated. I want when I click on another row, the row being edited will be cancelled. Can you help me?


3 Replies

MS Manivel Sellamuthu Syncfusion Team July 13, 2021 10:16 AM UTC

Hi Toan, 

Greetings from Syncfusion support. 

Based on your requirement you want discard the changes while clicking another row while editing. You can achieve your requirement by using the recordClick , actionBegin event of the Grid and closeEdit method of the Grid. Please refer the below code example and sample for more information. 

    <ejs-grid #grid [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings'  
(actionBegin)="actionBegin($event)" (recordClick)="recordClick($event)" [toolbar]='toolbar'> 
        <e-columns> 
. . .       </e-columns> 
    </ejs-grid> 
export class AppComponent { 
    public data: Object[]; 
    @ViewChild('grid', {statictrue}) 
    public grid: GridComponent; 
    public clickRowIndexnumber = -1; 
. . . 
 
    actionBegin (args) { 
        if (args.requestType === 'save' && this.clickRowIndex !== args.rowIndex) { 
// here if user clicked another row  while editing we can cancel the save action and cancel the changes 
            args.cancel = true; 
            this.grid.closeEdit(); 
        } 
    } 
 
    recordClick (args) { 
        this.clickRowIndex = args.rowIndex; 
    } 


Please let us know if you need further assistance. 

Regards, 
Manivel


TB Toan Bui July 15, 2021 07:40 AM UTC

I did it. Thank you so much



BS Balaji Sekar Syncfusion Team July 16, 2021 06:16 AM UTC

Hi Toan, 
   
We are happy to hear that your issue has been resolved. 
  
Please get back to us if you need further assistance. 
  
Regards, 
Balaji S 


Loader.
Up arrow icon