Hi,
I'd like to know if it is possible to manage the result that controller action send bakc after a "saveChanges" igGrid called method.
My controller action ends with:
JsonResult result = new JsonResult(); Dictionary<string, bool> response = new Dictionary<string, bool>(); response.Add("Success", true); result.Data = response; return result;
And I know that, if ("Success", true) everything goes right. But if I would like to have more info, or just catch ("Success", false), is there a way to get result in javascript section? Now I have (for example related to deleted row event):
$("#grid1").live('iggridupdatingrowdeleted', function (event, ui) { $("#grid1").igGrid("saveChanges"); });
If I put:
result = $("#grid1").igGrid("saveChanges");
I can see that result is a HTMLTableElement object...is it right? Do you have some suggestions to let me understand how manage saveChanges result or just to manage a negative come back result?Thank you,
Flavio
Hi Flavio,
if you return a JsonResult, the response should be in Json format, and not HTML, could you paste parts of the response (or the whole response) ?
Other than that, if you'd like to can add any number of callbacks to notify you when the response from saveChanges arrives:
$("#grid").data("igGrid").dataSource._addChangesSuccessHandler( <your handler>);
there is also
$("#grid").data("igGrid").dataSource._removeChangesSuccessHandler( <your handler>);
The parameters that will be passed to your function are: data, textStatus, jqXHR.
Hope it helps. Thanks,
Angel
Hi Angel,
sorry for the late answer. It is very good !!! But I am not able to use it...
I just added:
$("#myGrid").data("igGrid").dataSource._addChangesSuccessHandler( test() );
function test(){ // do something}
But for sure I am wrong, because adding a new row just stops and does anything: no written on db and no test method called...Could you explain me better waht you told me in your previous post?Where can I find some documentation or samples about dataSource._addChangesSuccesHandler or something like that?
Thanks