End edit mode when 'enter' key pressed

Hi,

When editing values in the datagrid. if 'enter' key is pressed on keyboard, the current cell still is in edit mode and you have to click on the other cell to end editing on this cell. Is it possible to end editing just after you press 'enter' key?   


I using:
Xamarin.Forms 4.7.0.1179
Syncfusion.Xamarin.SfDataGrid 18.2.0.46

Testing in:
Android 9 & 10

Thanks!

4 Replies 1 reply marked as answer

KK Karthikraja Kalaimani Syncfusion Team August 11, 2020 09:49 AM UTC

Hi Cristian,

We have not handled the Done key in Android platform. So only the current cell in EditMode after presses the Done key. So, currently we are finding a workaround to achieve your requirement. We will update further details on or before 12
th August 2020. We appreciate your patience until then. 

Regards,
Karthik Raja



KK Karthikraja Kalaimani Syncfusion Team August 12, 2020 01:51 PM UTC

Hi Cristian,

Your requirement can be achieved by loading custom entry on EditTemplate of GridTemplateColumn and write a renderer for the Custom Entry to detect the Done key press. Then based on it Call the EndEdit method  of SfDataGrid to end the Edit operation.

Regards,
Karthik Raja
 



DA Damian August 12, 2020 05:56 PM UTC

Could you put an example of this solution?


SS Sivaraman Sivagurunathan Syncfusion Team August 13, 2020 01:18 PM UTC

Hi Damian, 

Thanks for using Syncfusion controls. 

We have checked your query. you achieve your requirement by using the Entry with Completed event. We have prepared the sample based on you requirmrnt and attached for your reference. You can download the same from the below link. 


<sfGrid:SfDataGrid x:Name="dataGrid" 
                AutoGenerateColumns="False" 
                SelectionMode="Single" 
                AllowEditing="True" 
                NavigationMode="Cell" 
                ColumnSizer="Star" 
                ItemsSource="{Binding OrdersInfo}"> 
    <sfGrid:SfDataGrid.Columns> 
        <sfGrid:GridTemplateColumn HeaderText="Stock Change" 
                                MappingName="OrderID"> 
 
            <sfGrid:GridTemplateColumn.CellTemplate> 
                <DataTemplate> 
                    <Label Text="{Binding OrderID}"/> 
                </DataTemplate> 
            </sfGrid:GridTemplateColumn.CellTemplate> 
 
            <sfGrid:GridTemplateColumn.EditTemplate> 
                <DataTemplate> 
                    <Entry Completed="Entry_Completed" Text="{Binding OrderID}"/> 
                </DataTemplate> 
            </sfGrid:GridTemplateColumn.EditTemplate> 
        </sfGrid:GridTemplateColumn> 
    </sfGrid:SfDataGrid.Columns> 
</sfGrid:SfDataGrid> 
 
private void Entry_Completed(object sender, EventArgs e) 
{ 
    dataGrid.EndEdit(); 
} 




Regards, 
Sivaraman S 


Marked as answer
Loader.
Up arrow icon