I have a grid that does the batch update by doing $('#grid').igGrid('saveChanges'). In my controller that handles the save, I followed the sample code to return JsonResult whether it succeed or fail.
Is there an event that the grid dispatch once the save completed ? if so, how do I access that json result status ? I want to do some more logic once the save is done only when the save finished successfully.
Hi Borislav,
I am batching my updates back to the server and in the event where some of my records fail server side validations(lets say 2 out of 10 modified records), i am doing a rollback and sending the JSON response like mentioned in the sample: https://www.igniteui.com/grid/basic-editing.
At this point none of the records are committed back to the server. My problem is after user corrects the validation error(for the two records), and saves, only the 2 correct records are there in the transactionlist...
List<Transaction<ResultMetaData>> transactions = m.LoadTransactions<ResultMetaData>(HttpContext.Request.Form["ig_transactions"]);
Though the gird shows the changes, I am unable to access the other 8 records in my controller.
Please advice if you need more details/clarifications and suggest how I can handle failed cases when batching my updates.
Thank You,
Hari
No prob, Jeffrey :)If you need help with anything else, just let us know.Cheers,Borislav
Cool.. didn't realize that .data() is actually a jquery function. Thanks for the explanation.
Jeffrey
Ah, good question :)
$('#Grid1').igGrid('option', 'dataSource')
This helps you retrieve the value that you've assigned to the dataSource option of the igGrid - usually your source data.
$("#Grid1").data("igGrid").dataSource
This on the other hand gives you access to the igGrid's internal igDataSource object.I know that may not look like an out-of-the-box solution, but actually you end up accessing internal components of any jQuery UI widget, you end doing so through data().
Cheers,Borislav
Borislav,
One follow up question, what is the difference between doing this: $("#Grid1").data("igGrid").dataSource
and this: $('#Grid1').igGrid('option', 'dataSource')
Seems like the first one works better, as I find the second code doesn't always return me the dataSource object.