Focus on datagrid

Using the datagrid i receive this messagge "Not able to BeginEdit, EditItem is already set".
This message occurs every time a tap a row already saved in the list and then a try to focus on a cell of a new row i was inserting.
How can i reset the edititem?
Any idea of how to solve thi s problem?
Best regards
Alberto C.

3 Replies

SS Sivaraman Sivagurunathan Syncfusion Team January 11, 2018 07:17 PM UTC

Hi Alberto,  
 
Thanks for using syncfusion support. 
 
We have checked your query. The “Not able to BeginEdit, EditItem is already set"  exception occur while editing the cell and try to edit another cell before committing the previous edited cell’s value. If you call the SfDataGrid.View.CommitEdit() method before you perform the action in GridTapped event the edited value is commited in your collection. So you can perform your desired actions further. 
 
private int currentCellBeginEdit; 
 
dataGrid.CurrentCellBeginEdit += DataGrid_CurrentCellBeginEdit; 
private void DataGrid_CurrentCellBeginEdit(object sender, GridCurrentCellBeginEditEventArgs e) 
{ 
    currentCellBeginEdit = e.RowColumnIndex.RowIndex; 
} 
 
dataGrid.GridDoubleTapped += DataGrid_GridDoubleTapped; 
private void DataGrid_GridDoubleTapped(object sender, GridDoubleTappedEventArgs e) 
{ 
    if (e.RowColumnIndex.RowIndex == currentCellBeginEdit) 
    { 
        if (dataGrid.View.IsEditingItem) 
            dataGrid.View.CommitEdit(); 
    } 
    viewModel.OrdersInfo.RemoveAt(0); 
} 
 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Sivaraman  



AL Alberto January 12, 2018 08:25 AM UTC

It works


SS Sivaraman Sivagurunathan Syncfusion Team January 14, 2018 03:07 PM UTC

Hi Alberto, 
  
Thanks for your response.  
  
Thanks for the update. Please let us know, if you need any further assistance. 
  
Regards, 
Sivaraman 


Loader.
Up arrow icon