I'm attempting to populate the Kendo UI Grid with JSON returned from my web service (ASP.NET Web API). The JSON appears valid, confirmed valid by running the entire return through JSONLint.com.
Here is a sample from the service:
The problem is, the data returned from the service does not display in the grid. If I comment out the call to the service and use the array created below, the grid is populated. What's going on and how do I fix it?
The code below is my entire demo page.
Here is a sample from the service:
[{"Id":2000,"Name":"Alabama"},{"Id":2001,"Name":"Alaska"},{"Id":2002,"Name":"Arizona"}]
The problem is, the data returned from the service does not display in the grid. If I comment out the call to the service and use the array created below, the grid is populated. What's going on and how do I fix it?
The code below is my entire demo page.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Basic Grid usage</title> <link href="content/kendo/2012.2.710/kendo.common.min.css" rel="stylesheet" type="text/css"> <link href="content/kendo/2012.2.710/kendo.default.min.css" rel="stylesheet" type="text/css"> <script src="scripts/kendo/2012.2.710/jquery.min.js" type="text/javascript"></script> <script src="scripts/kendo/2012.2.710/kendo.web.min.js" type="text/javascript"></script> </head> <body> <div id="states"> </div> <script type="text/javascript"> $(document).ready(function () { var states = [ { Id: 1, Name: "Maine" }, { Id: 2, Name: "Washington" }, { Id: 3, Name: "Idaho" } ]; var statesDataSource = new kendo.data.DataSource({ data: states }); // var statesDataSource = new kendo.data.DataSource({ // transport: { // read: { // url: "http://XXX.com/apps/states", // dataType: "jsonp" // } // } // }); statesDataSource.read(); $("#states").kendoGrid({ dataSource: statesDataSource }); }); </script> </body> </html>