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

Trigger CurrentCellEndEdit with ok/commit button (virtual keyboard)

Hello there,

we have the following problem with our Android app (Xamarin.Forms.Android):
We have a SfDataGrid with an editable numeric column. The user can change the value of a cell, immediately after that a webservice request saves the changed value.

When we press the ok button on the virtual keyboard, the CurrentCellEndEdit-Event is not triggered and the request does not fire.
The user has to change to current selection (e.g. change the selected row) to the trigger the event.

Components like SfComboBox have a completed event which is triggered by pressing the commit button of the virtual keyboard. Is there a similar way to reproduce this behaviour in SfDataGrid?


3 Replies

KK Karthikraja Kalaimani Syncfusion Team November 21, 2019 05:55 PM UTC

Hi Maria,

 
Thanks for contacting Syncfusion support. 


Currently, we don’t have support for your requirement but we have workaround to achieve your requirement by overriding the GridCellNumericRenderer of SfDataGrid. We have prepared sample for the same. In that sample OrderID column is an only GridNumericColumn.


 
using Syncfusion.SfDataGrid.XForms.Renderers;
public
partial class MainPage : ContentPage 
{ 
   public MainPage() 
   {
    ……
    dataGrid.CellRenderers.Remove(
"Numeric"); 
    dataGrid.CellRenderers.Add("Numeric", new customNumericRenderer());

 
   } 
}

public class customNumericRenderer : GridCellNumericRenderer 
{ 
        public customNumericRenderer() 
        { 
             
        } 
 
        protected override SfNumericTextBoxExt OnCreateEditUIView() 
        { 
            var view = new NumericTextBox(); 
 
            return view; 
        } 
}

public class NumericTextBox : SfNumericTextBoxExt 
{ 
        /// <summary> 
        /// Initializes a new instance of the <see cref="NumericTextBoxView"/> class. 
        /// </summary>  
        public NumericTextBox() 
        { 
            this.Completed += NumericTextBox_Completed;   
        } 
 
        private void NumericTextBox_Completed(object sender, EventArgs e) 
        { 
            // you can write business logic here 
        } 
} 
  


We hope this helps, please let us know if  need further assistance from us.

Regards,
 
Karthik Raja 



AN Andy November 22, 2019 09:00 AM UTC

Thank you very much, the solution works!

I raised the Datagrid.EndEdit() void inside the NumericTextbox_Completed-Event to trigger the CurrentCellEndEdit-Event. Works fine!


FP Farjana Parveen Ayubb Syncfusion Team November 25, 2019 05:20 AM UTC

Hi Maria, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Farjana Parveen A 


Loader.
Live Chat Icon For mobile
Up arrow icon