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

Is there an event thrown when the user abort adding a new row ?

Hi,

I have joined in a SfDatagrid the event AddNewRowInitiating and it works very well.

But I'm not able to find (if it exists) an event raised when the user decides to abort the new row insertion pressing the Esc key.
Is there the possibility to be advised by an event when such a situation occurs ?

1 Reply

JG Jai Ganesh S Syncfusion Team August 24, 2016 02:00 PM UTC

Hi Silvio, 
 
We have analyzed your query. You can use the below code to handle AddNewRow abort operation by override GridSelectionController. 
 
this.datagrid.SelectionController = new GridSelectionControllerExt(this.datagrid); 
 
public class GridSelectionControllerExt : GridSelectionController 
    { 
        public GridSelectionControllerExt(SfDataGrid datagrid) 
            : base(datagrid) 
        { 
 
        } 
 
        public override bool HandleKeyDown(KeyEventArgs args) 
        { 
            if (this.DataGrid.View.IsAddingNew && !this.DataGrid.SelectionController.CurrentCellManager.CurrentCell.IsEditing) 
            { 
                // Write your code here 
            } 
            return base.HandleKeyDown(args); 
        } 
    } 
 
 
Regards, 
Jai Ganesh S 


Loader.
Live Chat Icon For mobile
Up arrow icon