I’m using the following snippet to call manually call the save function on the grid. I’m using inline editing.
The save function needs to return a custom object. How do I access the return value? Is there a callback function? Does the successfunc only return true/false?
jQuery("#grid_id").jqGrid('saveRow',rowid, succesfunc, url, extraparam, aftersavefunc,errorfunc, afterrestorefunc);
If you use
saveRowto save the local data you can just set the value of some external variable (the variable defined in the outer scope) inside of yourmySaveFunction. It’s important only to understand, that you have to useaftersavefuncparameter of editRow (or saveRow) instead ofsuccesfuncparameter. It’s typical misunderstanding, but thesuccesfunccallback will be called only in case of saving the data on the server. Thesuccesfunccallback will be not called in case of'clientArray'. I recommend you to use “object” form of theeditRowusage:On the other side you can consider to use callback functions as the parameter of your own
"Save"function. If the"Save"will haveafterSaveFuncparameter you will not need to use any return value of the"Save"function. You should just build your JavaScript script to work asynchronous instead of the classical synchronous sequential execution order.