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

Help with conditional templating based on json data

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rich
Top achievements
Rank 1
rich asked on 27 Oct 2015, 05:34 PM
Hi,

I want my grid to be populated from a json,the sample data is shown below

[
    {
        "id": 1,
        "name": "name1",
        "data": {
            "control": "textbox",
            "value": 700
        }
    },
    {
        "id": 2,
        "name": "name2",
        "data": {
            "control": "checkbox",
            "value": true
        }
    }
]


so in my grid under the "data" column the view should contain a textbox for row1 and a checkbox in row2 with the respective values and also possible to update the values.

Is it possible to achieve this using kendo ui grid?Is there any examples available.for this.

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 29 Oct 2015, 12:20 PM

Hello rich,

 

By design the DataSource does not support nested data structures. 

It is possible to display the nested fields through templates like in the provided example, but the other functionality such as grouping, filtering and sorting will not work.

 

In order to customize the UI for the cell you can use the columns.template. Please refer to the third example that shows how to access the dataItem object in the template and return string. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
rich
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or