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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Go to next edit cell

Thread ID:

Created:

Updated:

Platform:

Replies:

150453 Jan 7,2020 07:42 PM UTC Jan 10,2020 02:06 PM UTC Xamarin.Forms 3
loading
Tags: SfDataGrid
Maxence Roberge
Asked On January 7, 2020 07:42 PM UTC

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

Karthikraja Kalaimani [Syncfusion]
Replied On 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


Maxence Roberge
Replied On 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

Karthikraja Kalaimani [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon