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

getchanges and applychanges

3 Answers 171 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bert
Top achievements
Rank 1
Bert asked on 01 Apr 2016, 09:49 AM

Hi,

i want to use the grid in an existing html form. When I submit the form, I want to get the changes in the grid and submit them by using an hidden field.

When the form throws an serverside error I want to reload the grid and reapply the changes without saving them in the database.

i think this is normal form behaviour but it seems that it is not supported out of the box for the grid. How can I achieve this wanted behaviour?

 

a getchanges and applychanges method for the grid would be super...

 

3 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 05 Apr 2016, 07:27 AM

Hello Bert,

 

We have a project that illustrates similar behavior. Each column of the grid has its own client template (which is hidden input field in order to be sent as form data). Please refer to the Post grid data with form that shows how to submit the grid data items as part of a Html.Form. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bert
Top achievements
Rank 1
answered on 06 Apr 2016, 09:32 AM

Hi Boyan,

thanks for your reply. I have seen this example too, but I want the whole grid to be submitted, not the current page in the grid, and I want to be able to refresh the page and apply the changes that have been made before the submit when a serverside error is thrown.

a simple getchanges function wich gives me a json object with the changes of the grid and an applychanges function wich takes this json object as input would be perfect. As this does not exist I was wondering if you have an example that helps me with my problem.

 

0
Boyan Dimitrov
Telerik team
answered on 08 Apr 2016, 07:09 AM

Hello Bert,

I am afraid that we do not have such example. Since there is no getchanges or  applychanges methods that come out of the box with the Kendo UI DataSource I would suggest the following: 

   1. To use the hasChanges method of the Kendo UI DataSource in order to determine whether there is a change in the DataSource. 

   2. If yes - you can iterate through the data items returned by the data method of the Kendo UI DataSource and check if the dirty field of the data item is true. 

   3. Each item that has true for dirty field can be pushed in array to contain all modified items. 

There is no way to submit the entire grid along with the form since only items for the current page are rendered (therefore hidden inputs will be made only for the current page). 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Bert
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Bert
Top achievements
Rank 1
Share this question
or