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

A true way to display hierarchical data

2 Answers 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pavel
Top achievements
Rank 1
Pavel asked on 08 Aug 2014, 05:20 PM
I have to bind a kendoGrid to the following data structure:

- Workdays/Weekend
-- Morning/Afternoon/Evening
--- Regular price/Price for students
---- Price row (which has the following fields: Hours, Price, DiscountedPrice, all are numerics).

Here's what the json looks like: http://jsfiddle.net/ugg6vsxx/1/

I'd like to have html structure similar to this: http://dojo.telerik.com/ENIK but without changing the json structure.
Is it possible?
Thanks.




2 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 12 Aug 2014, 08:08 AM
Hello Pavel,

The DataSource is designed to work with flat (non nested) data structures. In other words binding the data structure that you showed is not possible out of the box.

In the example that you referenced the hierarchical structure is achieved by grouping of the data. There is alternative approach that you can use which is demonstrated in this demo page, but both of them require changes in the data structure.

There are a few approaches that you can follow:
- flattering the data structure and use client side grouping as shown in the example that you referenced
- use server side grouping by setting serverGrouping configuration option of the dataSource to true. In this case the data should be in the format shown here.
- use detail template. In this case each child will be a separate Grid widget with its own flat dataSource. The children will be loaded on demand when user expands the detail level. For reference please see the demo page.

I hope this information will help.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Pavel
Top achievements
Rank 1
answered on 12 Aug 2014, 10:20 AM
Thank you for the asnwer
Tags
Grid
Asked by
Pavel
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Pavel
Top achievements
Rank 1
Share this question
or