Bind to Grid

4 posts, 0 answers
  1. GM72
    GM72 avatar
    23 posts
    Member since:
    Sep 2012

    Posted 14 Jan Link to this post

    Hi,

    I have a complex object like

    ID 

    Name

    Dob

    EmploymentDetailsObject

    EmergencyContactObject

    I want to bind this to a Kendo Grid so the ID/Name/Dob/ are the parent row and the EmploymentDetails and EmergencyContact are child rows to this parent

    I return a collection of these from an API. I thought I could just bind this collection to the Grid but it doesn't seem to work?

     Can I do this? What do I need to do?

     

    Thanks

  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 18 Jan Link to this post

    Hi,

    The Grid does not support the use of HierarchicalDataSource, however you could achieve similar results using a regular DataSource. As a workaround you can try using the detailInit event handler to get the data from the complex object and populate the child Grid's DataSource with it (see similar example here). I would also recommend considering the TreeList widget instead.

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. GM72
    GM72 avatar
    23 posts
    Member since:
    Sep 2012

    Posted 18 Jan in reply to Alexander Popov Link to this post

    Hi,

     I thought about that but I was interested in multiple childs for 1 parent - is this possible using this method??

     Thanks

  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 20 Jan Link to this post

    Hi,

    Having multiple child Grids is possible and can be done using the detailInit event handler. Instead of initializing just one Grid as shown here, initialize as many as necessary.

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready