hi all, new to kendo, new to json. Can't seem to get any data into a kendo.data.DataSource. Am using the new 2012 q1 mobile release and ASP.NET MVC 3. Here's my code:
js:
// create a template using the definition on the application page (the .cshtml file) var templateFundingSources = kendo.template($("#template-funding-sources").html()); dataSource = new kendo.data.DataSource({ transport: { read: { url: "/Home/GetCardFundings", // the remove service url dataType: "json", // JSONP (JSON with padding) is required for cross-domain AJAX data: { //additional parameters sent to the remote service _cardId: cardID } } }, schema: { data: "cardFunding", model: { id: "CardID", fields: { CardID: { type: "number", nullable: false }, RemainingBalance: { type: "number" } } } }, change: function () { // subscribe to the CHANGE event of the data source $("#listview-card-fundings").html(kendo.render(templateFundingSources, this.view())); } }); dataSource.read();
//test data source to see it's defined dataSource.add({ cardID: 4, remainingBalance: 34 });
and MVC code:public JsonResult GetCardFundings(int _cardId) { List<CardFunding> cfs = new List<CardFunding>(); CardFunding cf = new CardFunding(); cf.CardID = 1; cf.RemainingBalance = 3; cfs.Add(cf); CardFunding cf1 = new CardFunding(); cf1.CardID = 1; cf1.RemainingBalance = 3; cfs.Add(cf); return Json(cfs, JsonRequestBehavior.AllowGet); }
The server-side code gets called and returned, and no execptions are tripped anywhere there or in the .js.
Any help greatly appreciated.
Kendo team: Awesome job on the project. Looking forward to mastering your framework.