Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Understanding commit, updateurl, transactionlog, saveChanges
posted

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:

  • To persist a update to a row, what should I do ? 
    • A) In the rowupdated event, call "saveChanges" on the grid. (updateUrl is set)
    • B) In the rowupdated event get the modified cells and post them myself?
  • To commit the changes on the client? (assume this is in UI clearing the italic font)
    • A) Call commit() after a successfull update
    • B) Set autoCommit = true, and return "Success" = true
  • What about the transaction log?
    • A) Don't care about it, it just works
    • B) It is important, this is what gets sent on saveChanges
    • C) It gets cleared on every commit

 

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

Parents
No Data
Reply
  • 24671
    Suggested Answer
    posted

    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 

     

Children