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

Kendo template - array of arrays

1 Answer 383 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pavan
Top achievements
Rank 1
Pavan asked on 08 Dec 2020, 01:43 AM

I have Json in below format (array of arrays) and defined in cshtml as an observableObject. I want to bind it using Kendo Template MVVM.

1. Can some one help how to define the kendo template to display a table using below JSON structure?

2. What should be passed as source in place of ??? So that the template displays accordingly.

3. how can we access the current item in kendo template?

{ "Type": 1, "Data": [{ "Category": "Sample Rows", "Result": [ [{"Name": "Column1", "Value": "Value1"}, {"Name": "Column2","Value": "Value2"}], [{"Name": "Column1","Value": "1"}, {"Name": "Column2", "Value": "2"}] ] } ] }

 

<script id="table-data-template" type="text/x-kendo-template"> <table> <thead data-template="header-template" data-bind="source: Result[0]" /> <tbody data-template="row-template" class="row-item" data-bind="source: ???"></tbody> </table> </script>

<script id="header-template" type="text/x-kendo-template"> <th data-bind="text: Name"></th> </script>

<script id="row-template" type="text/x-kendo-template"> <tr data-template="column-template" data-bind="source: ???"></tr> </script>

<script id="column-template" type="text/x-kendo-template"> <td data-bind="text: Value"></td> </script>

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 09 Dec 2020, 11:41 AM

Hello,

I have inspected the code provided and noticed that both kendo Template and MVVM are used. I would recommend you to review both articles and choose which one do you need in your case because it is not quite clear from the explanation provided. If your scenario is somehow more specific please share all the code that is related to these templates so we could be more helpful.

Regards,
Plamen
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Pavan
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or