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

[Solved] Apply batchEditing change log to grid.

2 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bob
Top achievements
Rank 1
Bob asked on 13 Jan 2012, 10:48 PM
I know how to get access to the changeLog of the grid so I can see the added/edited/deleted fields. But, I would like to be able to apply that info to the grid. I need to do this because while I am using Ajax binding and batch editing, I am not using the grids inbuilt submit changes... rather I am putting the change log info into hidden fields and posting it to the server.

However, if some validation error occurs when checking the model and I reload the Edit view, the grid does an Ajax select/bind again and the users changes are lost. I want to apply the change log back to the grid.

How can I do this? Any pointers would be appreciated.

BOb

2 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 18 Jan 2012, 10:04 AM
Hi Bob,

I am afraid this functionality is not supported. Even if you have the items representing the changes made to the Grid before the refresh of the page (you can use the insertedDataItemsupdatedDataItemsdeletedDataItems methods the get the collection) you cannot apply the changes to the Grid after the refresh. I suggest you use Ajax to submit the form data, this way if the submit fails the Grid and other items will keep their state and you will not need to restore the changes made to the Grid before the submit.


Regards,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Bob
Top achievements
Rank 1
answered on 18 Jan 2012, 04:25 PM
I have another thread there about this situation more of a general topic. This isn't a single grid with two or three extra form fields that I want to submit... it is an edit for with 80 or so other fields and 2 grids to edit child data. So, even if I wanted to just add all those fields to be submitted with the grid how would it work with two grids?

I have tried several ideas. I did try to use the grids submit changes and then submit the form. Then in the onComplete if there was no error submit the form. This works somewhat. Currently I am taking the changes prior to submit and putting them into fields, as I describe above. 

In both cases getting this to work properly and being able to handle validation issues or errors that occur in either the grid(s) or the form fields and retain all the changes made so the user doesn't have to re-edit everything is proving very difficult.

This seems a very common use case that the designers of your grid just didn't consider. Just submitting grid changes via AJAX is not the answer. The first problem with this is during a create. There is NO parent record yet... so how can I be adding related children. Or, during an edit... if the user makes changes to the child grid and then decided not to save their changes in the form... the grid changes have been made and saved and that is not expected. 

Being able to apply the changes from a stored change log would be almost the last hump I have to get over to use the telerik grid for this use case, which is very common in our app. I know you do care if I use your control or not, so take this as constructive feedback which is how it is meant.

Thanks for your help up to this point.

BOb
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Bob
Top achievements
Rank 1
Share this question
or