This is a migrated thread and some comments may be shown as answers.

Save edits client side until save?

6 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 16 Apr 2015, 05:04 PM

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.

6 Answers, 1 is accepted

Sort by
0
Scott
Top achievements
Rank 1
answered on 16 Apr 2015, 05:11 PM
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.
0
Scott
Top achievements
Rank 1
answered on 16 Apr 2015, 05:47 PM

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?

0
Vladimir Iliev
Telerik team
answered on 20 Apr 2015, 12:41 PM
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.

 
0
Scott
Top achievements
Rank 1
answered on 20 Apr 2015, 01:12 PM

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?

0
Vladimir Iliev
Telerik team
answered on 21 Apr 2015, 07:28 AM
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.

 
0
Scott
Top achievements
Rank 1
answered on 21 Apr 2015, 12:52 PM
Ah, I knew there had to be something! Thanks Vladimir, that looks like exactly what I'm after.
Tags
Grid
Asked by
Scott
Top achievements
Rank 1
Answers by
Scott
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Share this question
or