getchanges and applychanges

4 posts, 0 answers
  1. Bert
    Bert avatar
    2 posts
    Member since:
    Apr 2015

    Posted 01 Apr 2016 Link to this post

    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...

     

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 05 Apr 2016 Link to this post

    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!
     
  3. Bert
    Bert avatar
    2 posts
    Member since:
    Apr 2015

    Posted 06 Apr 2016 in reply to Boyan Dimitrov Link to this post

    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.

     

  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 08 Apr 2016 Link to this post

    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!
     
Back to Top