I'm initialising a chart in MVC razor syntax, and am unable to find a way of specifying the schema of returned data from an AJAX bound DataSource, as specified in the DataSource documentation:
schema: {
data: "results" // twitter's response is { "results": [ /* results */ ] }
}
As I'm not autobinding my chart, I've tried setting the schema property in JS before calling the read() method on the DataSource , but this doesn't seem to make any difference:
chart.dataSource.options = { schema: { data: "results" } };
Is this functionality possible using the ASP.NET wrappers?
schema: {
data: "results" // twitter's response is { "results": [ /* results */ ] }
}
As I'm not autobinding my chart, I've tried setting the schema property in JS before calling the read() method on the DataSource , but this doesn't seem to make any difference:
chart.dataSource.options = { schema: { data: "results" } };
Is this functionality possible using the ASP.NET wrappers?
5 Answers, 1 is accepted
0
Hello,
Tsvetomir Tsonev
the Telerik team
The DataSource schema will be generated automatically from the specified model class. You can specify the model class as a generic argument:
@(Html.Kendo().Chart<ElectricityProduction>()
.Name("chart")
.DataSource(ds => ds.Read(read => read.Action("_Read", "Home")))
...
I hope this helps.
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Orrin
Top achievements
Rank 1
answered on 02 Jan 2014, 08:57 PM
I have the same question and can't rely on the auto-bind. How would I map the data property to Mymodel.ChildCollection?
0
Hello Orrin,
Setting the schema explicitly is not supported via the MVC wrappers. The raw JS API might make more sense in your case.
Do you mind sharing a bit more details about your setup?
Regards,
T. Tsonev
Telerik
Setting the schema explicitly is not supported via the MVC wrappers. The raw JS API might make more sense in your case.
Do you mind sharing a bit more details about your setup?
Regards,
T. Tsonev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Hi,
Just a quick follow-up. You can also try passing the collection to the constructor:
@(Html.Kendo().Chart(Mymodel.ChildCollection)
I hope this helps.
Regards,
T. Tsonev
Telerik
Just a quick follow-up. You can also try passing the collection to the constructor:
@(Html.Kendo().Chart(Mymodel.ChildCollection)
I hope this helps.
Regards,
T. Tsonev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Orrin
Top achievements
Rank 1
answered on 07 Jan 2014, 05:27 PM
Okay, thanks. I had a complex model I wanted to bind to my form (parent with child collection), which I've since learned KendoUI doesn't support. I've broken my view model into separate models for each level of the hierarchy as suggested in other posts.