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

ejGrid - Prevent "Enter" Key from Inline Edit Form Submission

I have an inline edit form and need to be able to prevent form submission when the user presses the ENTER key. It appears to be calling "editFormValidate".

3 Replies

MS Mani Sankar Durai Syncfusion Team May 19, 2017 11:16 AM UTC

Hi Matt, 

Thanks for contacting Syncfusion support.  

We have analyzed your query and we can achieve your requirement using keySettings property in grid. We have also prepared a sample based on query that can be available from the below link. 
In this sample using keySettings property we can used to prevent the record save while pressing enter key.  By overriding the value of saveRequest a sub property of keySettings, you can prevent the saving Grid records while pressing enter key. The default value of the saveRequest is “13” keycode for an enter key 
Refer the code example. 
$(function () { 
                var element = $("#Grid"); 
                element.ejGrid({ 
                    dataSource: window.gridData, 
                    allowPaging: true, 
                    keySettings: { 
                        saveRequest: "",     //default key code is 13 for enter key 
                    }, 
                    ... 
                    columns: [ 
... 
                    ], 
                        }); 
                
            }); 

Refer the documentation link. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai 



AP alessandro proietti July 22, 2019 09:34 AM UTC

good evening I have a problem on an ej grid, I wish that when I have to confirm the data in the ej grid I don't have to press the enter key on the keyboard but I can click with the muose off the grid. good job


PK Padmavathy Kamalanathan Syncfusion Team July 24, 2019 01:42 PM UTC

Hi alessandro, 

Thanks for contacting Syncfusion Forums. 

QUERY: Need to save edited data when I click off the grid 
 
 
From your query we understand that you need to save your edited row when you click outside your grid. This can be achieved by calling endEdit method in “mouseleave event” (during actionComplete event)when you move your mouse out of your grid. Please refer the below code snippet, 


     actionComplete: function(args) { 
          if (args.requestType == "beginedit"){ 
              $("#" + this._id).on("mouseleave", function(e){ //mouseleave event 
                var gridObj = $("#Grid").data("ejGrid"); 
                var ddl = $(".e-ddl-popup") 
                if ((e.relatedTarget == null) || (!ddl)) { 
                  gridObj.endEdit(); // calling endEdit method for saving edited cell 
                } 
                   }); 
           } 
     } 


Please refer the below sample for better understanding, 

If you have further queries, please get  back to us. 

Regards, 
Padmavathy Kamalanathan 


Loader.
Live Chat Icon For mobile
Up arrow icon