1

I perform jqgrid edit via formatter actions. And when the edit validations fails in server and I display the errors to user, I want to remain in the edit mode and save the user entered data. Is it possible. Please help.

user2375298
  • 1,001
  • 4
  • 15
  • 28

1 Answers1

1

You should use restoreAfterError: false option of inline editing. I recommend you to set the option by changing defaults of inline editing:

$.extend($.jgrid.inlineEdit, {
    restoreAfterError: false
});

Alternatively you can set restoreAfterError in formatoptions:

formatter: "actions", formatoptions: {restoreAfterError: false, keys: true, ...}
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Hi oleg, I am getting the error from server side, How will I make sure the error goes into this block : onError: function (rowid, jqXHR, textStatus) – user2375298 Nov 06 '14 at 10:52
  • if possible let me know how to call on error function – user2375298 Nov 06 '14 at 11:42
  • @user2375298: `onError` is in general correct way, but you can set `errorfunc` callback in `$.jgrid.inlineEdit` too. – Oleg Nov 06 '14 at 12:29
  • No my function will come into success as I m my http status will be success. But my validation are custom messages that is returning from server. So in that case how will I make the onError function is invoked – user2375298 Nov 06 '14 at 13:05
  • @user2375298: You need just set some error HTTP status code (>=400) in the HTTP response. Alternatively you can use `successfunc` instead of `errorfunc` but you need to return from `successfunc` the array `[false, "error message get from the server response"]` – Oleg Nov 06 '14 at 14:22