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

Passing local json array as grid datasource

1 Answer 1223 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Damian
Top achievements
Rank 1
Damian asked on 24 Jul 2018, 10:48 AM

I'm currently evaluating the Grid control, and managed to build my grid using c# using the html helper. 

My dataset has too many columns to put into one row and I trying to building a child grid using a client template to pass it the additional columns required. 

My c# function contain the bones of the child grid based upon an ExpandoObject, along with a local json array that I would like to insert into the datasource, can you tell me how I am able to achieve this?

var jsonColumns = Newtonsoft.Json.JsonConvert.SerializeObject ( row );

var grid = html.Kendo ().Grid<System.Dynamic.ExpandoObject> ()
       .Name ( "test" )
       .ToClientTemplate();

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 26 Jul 2018, 08:42 AM
Hello Damian,

First, I would like to point out that the Grid does not work with ExpandoObject and for dynamic columns structure you will have to use the approach demonstrated in the following HowTo article:
As for setting an array to the DataSource of the Grid, you could use its "data" method:
For populating the Grid in the detail template you could handle the "DetailInit" event of the Grid:
Hope this helps.


Regards,
Konstantin Dikov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Damian
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or