Save edits client side until save?

7 posts, 0 answers
  1. Scott
    Scott avatar
    18 posts
    Member since:
    Mar 2015

    Posted 16 Apr 2015 Link to this post

    I have a Service Contract that can have many pieces of Covered Equipment. I would like to use the grid control to let users add and edit equipment BEFORE the parent object is created (basically storing it all client-side, and then sending it back with the parent info in one form POST).

    Is this scenario possible? All of the examples I've found are using AJAX calls on each edit, which I can't do.

  2. Scott
    Scott avatar
    18 posts
    Member since:
    Mar 2015

    Posted 16 Apr 2015 Link to this post

    I don't know how I missed the batch editing demo, but that looks like it will work as long as I can tap into its save functionality.
  3. Scott
    Scott avatar
    18 posts
    Member since:
    Mar 2015

    Posted 16 Apr 2015 in reply to Scott Link to this post

    I'm so close, I have to be missing something.

     

    The SaveChanges event is the one I need to capture, but I can't see a way to grab the set of changes. Can anyone point me in the right direction?

  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 20 Apr 2015 Link to this post

    Hello Scott,

    If you need to submit the Grid which edits the child object along with form element containing other input elements that you can check the following demo in our CodeLibrary:

    Regards,
    Vladimir Iliev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  5. Scott
    Scott avatar
    18 posts
    Member since:
    Mar 2015

    Posted 20 Apr 2015 in reply to Vladimir Iliev Link to this post

    Thanks Vladimir. That's essentially what I ended up doing, although I added the hidden fields in the onSave event handler and remove them in onDataBinding if the action is "remove".

     

    I was really hoping for some client API where I could just say "getChanges()" and get an array of the added and changed rows. Perhaps in a future version?

  6. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 21 Apr 2015 Link to this post

    Hi Scott,

    Actually using the current grid and it's dataSource API you can implement custom solution which to get all records which are modified on the client side. For example you can iterate over the available records returned by the "data" method and check for their "dirty" flag. Additionally you can distinguish new records from old ones using the model "isNew" method. 

    Regards,
    Vladimir Iliev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  7. Scott
    Scott avatar
    18 posts
    Member since:
    Mar 2015

    Posted 21 Apr 2015 in reply to Vladimir Iliev Link to this post

    Ah, I knew there had to be something! Thanks Vladimir, that looks like exactly what I'm after.
Back to Top