We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Prevent from click outside editing row

Hi,
i've got a question. Is there any way to prevent a user to click outside current editing row? User can only edit row by selecting one and clicking 'Edit' button on the toolbar. If he wants to save changes he can click on 'Update' button (also on toolbar). While editing, user can click outside editing row and then edit mode is turning off - I want to prevent this situation.



3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team May 14, 2019 08:51 AM UTC

Hi James, 

Greeting from Syncfusion. 

We have analyzed your requirement and we can achieve your requirement using the toolbarClick, actionBegin event of Grid. Please refer the below code example and sample for more information. 

<ejs-grid #grid id='Normalgrid' [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar' (actionBegin)='actionBegin($event)' (toolbarClick)='toolbarClick($event)' > 
    <e-columns> 
        . . . . . 
    </e-columns> 
</ejs-grid> 


toolbarClick(args){ 
  if(args.item.text==="Update"){ 
    this.flag = false; 
  } 
} 
actionBegin(args: any) :void { 
    if(args.requestType ==='save'){ 
        // when apply args.cancel as true then it prevent from save action 
        args.cancel = (this.flag) ? true : false; 
        this.flag = true; 
    } 
} 



Refer the help documentation. 



Regards, 
Thavasianand S. 



JE James Evangelist May 14, 2019 11:25 AM UTC

This solution works great! Thanks for help.


TS Thavasianand Sankaranarayanan Syncfusion Team May 14, 2019 11:46 AM UTC

Hi James, 
 
We are happy that the problem has been solved. 
 
Please get back to us if you need any further assistance.  
                          
Regards, 
Thavasianand S.

Loader.
Live Chat Icon For mobile
Up arrow icon