Hi!
I'm unable to figure out how to do persist a update into my server. I've not found any good examples on how to use the "saveChanges" functionality. From the blogpost here: #mce_temp_url# I found that returning a "Success" = true, should clear the transaction log, but it does not seem to do it. (but I might have misunderstand how it should work)
So, here are my questions:
As you can see from my question I'm a bit confused on how to do this. I found no good documentation describing this functionality.
Thanks for any help
Larsi
Hi Larsi,
I hope you are using 11.2 , and not 11.1 (because this functionality is not present in 11.1).
You can start by taking a look at this sample:
http://samples.infragistics.com/jquery/grid/batching-updates
Have a look at the View's javascript code, and then at the following controller action: EditingSaveChanges.
as for handling Success vs failure, since saveChanges is async, it attaches event handlers internally, so that when the response comes back from the server (with either Success true or false), it calls commit respectively.
I will try to answer your specific questions:
=> To persist a update to a row, what should I do ?
It depends if you want immediate updating, or batch updating. if you'd like an update to be triggered after every row editing, then you can handle rowUpdated, and call saveChanges(). Note that updating is on two levels in the grid. depending on the value of autoCommit. If it's true, changes are automatically updated on the client data source (no italic font) , but you still have to call saveChanges so that they are propagated to the server as well. If you'd like batch updating, you can have any UI (such as a button), which calls saveChanges, whenever some rows are updated - depending on your application logic. if you are using the saveChanges API, you don't need to post anything manually. Also please note that a prerequisite of this is to set the updateUrl to the controller action which does the actual persistence. the Batch updating sample i have referenced above has this.
=> To commit changes to the client ?
If autoCommit is true, then those changes are commited automatically (and therefore no italic fonts are applied for modified cells or rows)
If autoCommit is false, you can call commit() using either rowupdated / cellupdated or using some specific UI in case you are having a batch updating scenario
=> What about the transaction log?
Save changes sends a serialized JavaScript array of transaction objects, which contain the row id (primary key), and a list of the modified row values. it only sends the modified data, not the whole grid data that's currently bound.
Hope it helps. Let me know if you have any other questions.
Thanks,
Angel
Great! Thanks for your detailed answer.
A few follow ups:
* Calling commit() on the grid does not remove italic. Should it?
* Calling saveChanges, and returning {"Success":true} does not remove italic. Should it?
* Calling saveChanges, and returning {"Success":true} does not clear transaction log, that is, the same changes are sent over and over. Should it?
Thanks again for looking into this