Hi,
I am programming a MVC3 project and using jQuery to retrieve data. While working on this I stumbled upon the following issue. I'll post a code sample to illustrate this:
As you can see I am fetching data from a Action. This works well as the #outputText is showing well formatted JSON. When copying this text and pasting in the code above I get a perfectly working graph. But when using "data: ds.SummaryDataSource" (which should be the same) it is not working. How can I convert the string ds.SummaryDataSource to a KendoUI DataSource?
Thanks in advance!
Best regards,
Peter
I am programming a MVC3 project and using jQuery to retrieve data. While working on this I stumbled upon the following issue. I'll post a code sample to illustrate this:
jQuery.getJSON("@Url.Action("DashboardData", "Dashboard")", function(ds) {
$("#projectStateChart").kendoChart({
theme: "black",
title: { text: "" },
legend: { position: "right" },
dataSource: { data: ds.SummaryDataSource },
series: [{ type: "pie", field: "Count", categoryField: "State", startAngle: 160, padding: 0 }]
}).data("kendoChart");
$("#outputText").text(ds.SummaryDataSource);
});
As you can see I am fetching data from a Action. This works well as the #outputText is showing well formatted JSON. When copying this text and pasting in the code above I get a perfectly working graph. But when using "data: ds.SummaryDataSource" (which should be the same) it is not working. How can I convert the string ds.SummaryDataSource to a KendoUI DataSource?
Thanks in advance!
Best regards,
Peter