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

How to confirm row edit

Thread ID:

Created:

Updated:

Platform:

Replies:

149940 Dec 15,2019 08:02 PM UTC Dec 16,2019 12:34 PM UTC ASP.NET MVC - EJ 2 2
loading
Tags: Grid
Fayçal HANNOUN
Asked On December 15, 2019 08:02 PM UTC

I have a grid in which i am enabling row edit. When i add a new row (the datasource is a local JS list of objects) and i want to confirm the newly added row, i cannot.
In other words, i am stuck in edit mode. If i press escape, the row get discarded and deleted. But no matter what i press (Enter, Ctrl + Enter, Shift + Enter) i am stuck in edit mode, unless i click on another row and then the newly added row get confirmed and added to the datasource.

Note:
If i click anywhere else other that another row, the newly created row won't get added to the datasource. For example, if when i'm done editing and i click on the save button, the newly created row won't get added to the datasource and it won't get sent to the server.

The same goes for editing existing rows wether on double click or on pressing F2.

PS: I have a "IsPrimaryKey" column.

Can you please show me how to confirm row editing ?

Thank you in advance.

Fayçal HANNOUN
Replied On December 15, 2019 10:30 PM UTC

I figured it out.

I used the keyPressed event and used the endEdit method of the grid. Here is the code

function gridInvoicesKeyPressed(e) {        
        if (e.code === "Enter") {
            let grid = document.getElementById('grid-invoice-lines').ej2_instances[0];
            if (grid.isEdit)
                grid.endEdit();
        }
    }

Thanks to the code example "Enable single click edit" otherwise, i wouldn't have been able to figure it out only by reading the documentation since the method is nowhere to be found !

I think the documentation could explain a little bit more what each method does and if possible, give some use case examples (one or two chould be enough).
Anyway, i posted the answer in case someone would find it useful in the future.

Thank you and please enhance the documentation.

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On December 16, 2019 12:34 PM UTC

Hi Fayçal, 

We could see you would like to access the Grid functionalities using the keyboard navigation. Somehow, you have managed to achieve the requirement. However, we have provided default support for the keyboard actions in the Grid. Refer to the following code example.  


Regards,  
Seeni Sakthi Kumar S 


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