Two time call on save cell url in jqgrid (one in case of enter which is default behavior of jqgrid) other is custom save on focusout.
I need to prevent two save calls on cell edit when I enter for save.
column.editoptions.dataEvents = [{ type: 'keyup focusout', fn: function(e) { var isValidate = ValidateGridEmail($(this).val()); EmailValidationMessage(isValidate); if (e.type == "focusout" && isValidate && globalVar.irow != null && globalVar.icol != null) { $("#GridEditConfiguration").saveCell(globalVar.irow, globalVar.icol); globalVar.irow = null; globalVar.icol = null; } } }]
Advertisement
Answer
You can use some events to do this, but I’m not sure that free-jqGrtid has these. This is not supported version.
In the supported Guriddo jqGrid you can use beforeSaveCell to signal the start of saving and then use this in your condition. Set signal in afterSubmitCell back to false.
Like this:
var savestart = false; $("#jqGrid").jqGrid({ beforeSubmitCell : function( id, name, val, irow,icol) { savestart = true; }, afterSubmitCell : function() { savestart = false; return [true,""]; }, .... });
in your code add this
if (e.type == "focusout" && isValidate && globalVar.irow != null && globalVar.icol != null && !savestart) { $("#GridEditConfiguration").saveCell(globalVar.irow, globalVar.icol); ... }
Again you should check if these events are available in free-jqGrid