Hierarchical Grid linking child to parent DataSource and saving as a JSON Object

4 posts, 0 answers
  1. Augustin
    Augustin avatar
    2 posts
    Member since:
    Apr 2016

    Posted 29 Apr 2016 Link to this post

    Morning, guys!
    I`m pretty new to Kendo UI and yesterday I've encountered a problem which seems to be impossible for me to solve. Basically, I've got a Kendo hierarchical grid where I can add a new record for both parent and children by clicking a button. It looks something like this: http://jsbin.com/ubiruc/12/edit?html,js,output . I'm caught with 2 problems:
    1) At the start, my whole grid is empty. If I add rows and then their details, all fine. But if I add a row, its details and after that another row in the main grid, the added details for first parent disappears. 

    2) Stuck on how to save the whole structure in a JSON Object after I finished adding my wanted records.
    Hope someone can help me out with this as I've been searching the internet for over 6 hours and nothing. Thanks in advance, have a great day!
  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1600 posts

    Posted 03 May 2016 Link to this post

    Hi Gabriel,

    With respect to:

    Question 1: We can hardly help you unless we see source code showing what you are doing. Can you  attach your page here? Either raw or Kendo Dojo.

    Question 2: You may want to take a look at the persist state functionality.

    Regards,
    Genady Sergeev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Augustin
    Augustin avatar
    2 posts
    Member since:
    Apr 2016

    Posted 03 May 2016 Link to this post

    http://dojo.telerik.com/IGafI

     

    Here`s the link with the problem. Whenever i click Add new record in the main table, I want the child grid`s data to be saved (now if i click Add new record, all children`s data is removed). Also, when i finish adding new rows, I want to save the whole data source and post it to my backend.

  4. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2527 posts

    Posted 06 May 2016 Link to this post

    Hello Augustin,

    When the parent grid is refreshed (by adding new children), all child grids are removed. Thus, you need to persist the data while it is edited, either by syncing it to the server or by maintaining a client-side data storage that will be synchronized when the data is finished editing. Both can be achieved by configuring the child datasource, either by binding it to server methods, or to the client-side cache. The first approach is recommended, as the latter requires identifying records prior to their saving, but here is a Dojo that shows the latter approach.

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