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

Go to next edit cell

Hi,

I have a feature that I wanted to try and was wondering if it was possible.

What I wanted to do was, when the user is editing a cell, and he presses Enter, it commits the changes, and goes to the next cell (The next cell could be on the right, or under the current cell. Basically, the next editable cell), but I can't seem to make it work.

In my current project, I use the Completed event from the EditText cell to call the CurrentCellEndEdit event from the grid (to commit the changes), but what I can't figure out is how to open the next cell.

I've attached a sample with my current best attempt where I wait 200ms after closing the current cell to try to open the next cell, It works most of the time, but I would like a more reliable method to handle this, if possible. The first column is editable, and if you click on the second column, it should go to the next row and open the edit cell.

I am running the program on Android 6.0.

Is it possible to do what I'm attempting?

Attachment: GridEditSample_4714b6ef.zip

13 Replies

KK Karthikraja Kalaimani Syncfusion Team January 8, 2020 01:47 PM UTC

Hi Maxence,

Thanks for contacting Syncfusion support,

Your requirement can be achieved by creating the new custom cell renderes for SfDataGrid.CellRenderes. In that custom cell renderes we can end edit the cell when press done key on device keyboard. For more details please refer the below code example and attached sample.

Code Example,

 
[GridPage.Xaml.CS]

….
dataGrid.CellRenderers.Remove("TextView"); 
dataGrid.CellRenderers.Add("TextView", new CustomTextViewRenderer(this.dataGrid));
…..

internal class CustomTextViewRenderer : GridCellTextViewRenderer 
    { 
        SfDataGrid grid; 
        public CustomTextViewRenderer(SfDataGrid dataGrid) 
        { 
            grid = dataGrid; 
        } 
 
        protected override SfEntry OnCreateEditUIView() 
        { 
            var view = new CustomSfEntry(grid); 
            return view; 
        } 
    } 
 
    internal class CustomSfEntry : SfEntry 
    { 
        SfDataGrid dataGrid; 
        public CustomSfEntry(SfDataGrid sfDataGrid) 
        { 
            dataGrid = sfDataGrid; 
            this.Completed += CustomSfEntry_Completed; 
        } 
 
        private void CustomSfEntry_Completed(object sender, EventArgs e) 
        { 
            this.dataGrid.EndEdit(); 
        } 
    } 


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

Regards,
Karthik Raja



MR Maxence Roberge January 9, 2020 09:10 PM UTC

Thanks for that, but what I wanted was a better and more reliable way to move to the next cell than the one I was using. I want to be able to move to the next cell after pressing Enter. Is there any way I can do that?

Attachment: GridEditSample1_7b3c5dae.zip


KK Karthikraja Kalaimani Syncfusion Team January 10, 2020 02:06 PM UTC

Hi Maxence,

Thanks for contacting Syncfusion support,

We have moved your business logic from CurrentCellEndEdit Event to CompletedEvent on CustomRenderer of NumericTextBox. This is the most reliable way to achieve your requirement. For more details please refer to the below code snippet and attached sample.

Code Example,

 
….
 private void CustomSfEntry_Completed(object sender, EventArgs e) 
        { 
            this.dataGrid.EndEdit(); 
            this.dataGrid.BeginEdit(this.dataGrid.CurrentCellManager.RowColumnIndex.RowIndex + 1, this.dataGrid.CurrentCellManager.RowColumnIndex.ColumnIndex); 
        }
…. 

Sample link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/GridEditSample_4714b6ef_modified_2e1468237406.zip

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

Regards, 
Karthik raja 



FE FELIX replied to Karthikraja Kalaimani March 2, 2022 12:31 AM UTC

I have The same issue requirement in my app but this can't work on xamarin forms 5.0.02337 and SfDataGrid(19.4.0.54). What could be the problem. Am i missing something. I took the same sample and run using the latest nuget packages for SfDataGrid and it doesn't fire the events for Completion of Entry.

I would appreciate any assistance. this has made my project stall for days now. Thanks




SV Suja Venkatesan Syncfusion Team March 2, 2022 08:32 PM UTC

Hi Felix,


We are able to reproduce the reported scenario on our end. Currently, we are validating the same. We will update you with the further details on or before March 4,2022. We appreciate your patience until then.


Regards,
Suja




SV Suja Venkatesan Syncfusion Team March 4, 2022 02:01 PM UTC

Hi Felix, 

You can resolve the reported scenario by Custom renderer for SfEntry which is loaded as Edit View of GridTextColumn. We have attached a runnable sample based on your requirement in the following sample link for your reference. Please have a look at this sample and let us know if you have any concern in it. 


Regards, 
Suja 



FE FELIX March 7, 2022 10:15 PM UTC

Thank you so much. I have checked the sample and it is working well with syncfusionDatagrid version 18.4.0.49 on Android platform but it doesn't fire on Universal Windows platform(UWP)



SV Suja Venkatesan Syncfusion Team March 8, 2022 03:44 PM UTC

Hi Felix, 

Currently, we are validating the reported issue on our end. We will update you with further details on or before March 10, 2022. We appreciate your patience until then. 

Regards, 
Suja 




SV Suja Venkatesan Syncfusion Team March 10, 2022 06:48 PM UTC

Hi Felix,  

Still, we are validating the reported issue on our end. We are in need of two more business days to validate this. We will update you with further details on or before March 14, 2022. We appreciate your patience until then.  

Regards,  
Suja  




FE FELIX March 26, 2022 01:30 PM UTC

Hallo Venkatesan.

I am grateful for the progress we have come so far on the issue. I am still stuck on the UWP issue and would appreciate any breakthrough for the team. Thank you so much for your tireless work together with syncfusion team.






SV Suja Venkatesan Syncfusion Team March 28, 2022 02:33 PM UTC

Hi Felix, 

We deeply regret for the delay caused. You can achieve the same custom logic of completed event behavior also in processing the Enter key in custom GridSelectionController. We have attached a simple sample with Custom GridSelectionController for your reference in the below sample link. 


Please let us know if you need any further assistance. 

Regards, 
Suja 



FE FELIX April 29, 2022 08:34 PM UTC

Thank you syncfusion support. It has now worked both on Android and UWP for sfDataGrid version 18.4.0.49. This has revived my project from collapse. Thank you much now i can continue with my xamarin form cross platform project using syncfusion.


Regards

Felix



SV Suja Venkatesan Syncfusion Team May 2, 2022 03:19 PM UTC

Hi Felix,


Thanks for the update . Please let us know if you need further assistance. As always, we are happy to help you out.


Regards,

Suja


Loader.
Live Chat Icon For mobile
Up arrow icon