Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5989869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:09:46+00:00 2026-05-22T23:09:46+00:00

jQgrid row is edited using inline editing mode. Pressing Enter sends data to server

  • 0

jQgrid row is edited using inline editing mode.
Pressing Enter sends data to server using http POST .
POST method returns status 400 Bad reguest if there was some error. errorofunc in code below show error in this
case.
User corrects data in row and presses enter again.

Pressing enter is ignored, nothing happens. It looks like Enter key is unbound if 404 error is returned.
Changes in edited row are lost, they cannot saved.

I tried to set in errorfunc

restoreAfterError = false;
grid.restoreAfterErorr = false;

but row still cannot saved again after error.

How to allow to save correct row data after 400 error is returned ?

<script type="text/javascript">
var lastSelectedRow;
$(function () {
            var grid = $("#grid");
            grid.jqGrid({
                url: '/Grid/GetData',
                datatype: "json",
                mtype: 'POST',
                scroll: 1,
                multiselect: true,
                multiboxonly: true,
                scrollingRows : true,
                autoencode: true,
                colModel: [
        { name: 'Source', fixed: true, editable: true, width: 30 },
        { name: 'Est', fixed: true, editable: true, width: 271 },
        { name: 'Istopic', fixed: true, editable: true, width: 57 },
        {name: 'Critical', fixed: true, editable: true, width: 50}
    ],

                gridview: true,
                pager: '#pager',
                sortname: 'est',
                viewrecords: true,
                rowNum: 30,
                sortorder: "asc",
                editurl: '/Grid/Edit'
            });

            $("#grid").jqGrid('bindKeys', {
                onEnter: function(rowid) {
                    doeditRow(rowid);
                }
            }  );

        });

        function doeditRow(rowID) {
            var grid2 = $("#grid");
            if (rowID && rowID !== lastSelectedRow) {
                grid2.jqGrid('restoreRow', lastSelectedRow);
                lastSelectedRow = rowID;
            }
            invokeEditRow();
        }

        function errorfunc(rowID, response) {
            // todo: why this does not allow Enter key to continue ase after error:
            restoreAfterError = false;
            $("#grid").restoreAfterErorr = false;
            alert(response.responseText);
            lastSelectedRow = rowID;
            invokeEditRow();
            return true;
        }


        function invokeEditRow() {
             $("#grid").jqGrid('editRow', lastSelectedRow ,true,null, null, null, {},
                 null,
                 errorfunc
             );
        }
    </script>

<div id="grid1container" style="width: 100%;">
    <table id="grid">
    </table>
    <div id="pager">
    </div>
</div>

UPDATE: errrofunc calls editrow which
according to
https://github.com/tonytomov/jqGrid/blob/master/js/grid.inlinedit.js
should set enter key again to save.
For unknown reason this does not
occur.

UPDATE: in errorfunc grid. is changed to

        $("#grid").restoreAfterErorr = false;

according to Oleg comment

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:09:46+00:00Added an answer on May 22, 2026 at 11:09 pm

    You use variable grid inside of errorfunc implementation (grid.restoreAfterErorr). The grid
    is undefined and you have exception in the line.

    UPDATED: ou should replace alert(response.responseText); to

    $.jgrid.info_dialog($.jgrid.errors.errcap,'<div class="ui-state-error">'+
        response.responseText +'</div>', $.jgrid.edit.bClose,{buttonalign:'right'});
    

    to see the same styled dialog box as in the standard case. The errorfunc from the inline editing is responsible to display the error message itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.