Save hierachical grid information through javascript/Jquery (with a difference)

2 posts, 0 answers
  1. Joy
    Joy avatar
    1 posts
    Member since:
    Jun 2013

    Posted 19 Jul 2013 Link to this post

    Hi,
     
    im building a hierachy using grids for example: category -> products -> orders. i have in my category a list of products (public list<products> products {get; set;} and my products have a list of orders (public list<orders> orders { get; set; }).im using a hierachical grid structure with client templates defined for the parent grids.

    Now, when i add a category i do not create a record in DB but create it only on the Client (through javascript/Jquery) and so with products and orders. (i have logic to uniquely identify elements(grids) in the hierachy that enables me to add children under parent nodes). I want to be able to save all changes at one shot when i click a button(Save).

    * has someone tried something like this before with hierachical grid?
    * Is there an another way to accomplish this?
    * I tried to loop through the grid in javascript and take the data from child grids and assign it to the parent. i.e take orders and put it under products then take these products and put them under category. Once i call grid.saveChanges() (on the top most parent grid) and reach the controller the product list in category has fields that are null or if there are integer properties they are all reset to 0. Serialize? type mis match? what is causing this behavior? any examples?

    basically, if i could build an association with parent and child grid without hitting the controller to fetch child information with the #=parentID# that would be great!

    thanks!
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 23 Jul 2013 Link to this post

    Hello Joy,

    I am afraid that there is no feasible work around that we can recommend you to gather all the changes from all the levels of the hierarchy and send them to the server in a single request.

    Basically each of these grids have its own dataSource transport which they use to synchronize the changes with the server. So I would suggest you to just turn the AutoSync option to true for these Grids and thus the changes will be immediately send to the server after changing the values on the client.

    Kind Regards,
    Petur Subev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top