Note that there are some explanatory texts on larger screens.

plurals
  1. POKendo UI Grid sortable (and other properties) not working
    primarykey
    data
    text
    <p>I'm trying to configure a Kendo grid and I'm having issues when trying to add properties such as sorting, grouping, etc. The grid works until I add the property, then it doesn't display any of the data. I have looked at the documentation on Kendo's site and it looks as if I have everything the same as theirs but obviously I'm nissing something.</p> <p>Here is the View:</p> <pre><code>@model ExampleKendoUI.Models.HeaderVm @{ ViewBag.Title = "Index"; } &lt;h2&gt;Index&lt;/h2&gt; &lt;div&gt;@Model.Name&lt;/div&gt; @section scripts { &lt;script&gt; // Output the data as JSON var podata = @Html.Raw(Json.Encode(ViewBag.LineItems)); &lt;/script&gt; &lt;div id="poGrid" class="k-content"&gt; &lt;script&gt; $(document).ready(function () { $("#poGrid").kendoGrid({ dataSource: { data: podata }, // sortable:true, *** Uncommenting this will break the grid *** columns: [ { field: "Description", title: "Desc" }, { field: "Quantity", title: "Quantity" } ] }); }); &lt;/script&gt; &lt;/div&gt; } </code></pre> <p>Here is the controller:</p> <pre><code>namespace ExampleKendoUI.Controllers { public class SampleController : Controller { // // GET: /Sample/ public ActionResult Index(int id) { var header = new HeaderVm() { Id = id, Name = "Req ID" }; var results = new List&lt;PoLineVm&gt;() { new PoLineVm() { Id = 1, Description = "Some Product", Quantity = 1.5 }, new PoLineVm() { Id = 2, Description = "Another Product", Quantity = 4.0 }, new PoLineVm() { Id = 3, Description = "Last Product", Quantity = 20 }, }; ViewBag.LineItems = results; return View(header); }}} </code></pre> <p>Here is the _Layout:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8" /&gt; &lt;meta name="viewport" content="width=device-width" /&gt; &lt;title&gt;@ViewBag.Title&lt;/title&gt; @Styles.Render("~/Content/css") &lt;link href="~/Content/kendo/2012.3.1114/kendo.default.min.css" rel="stylesheet" /&gt; @Scripts.Render("~/bundles/modernizr") &lt;/head&gt; &lt;body&gt; @RenderBody() @Scripts.Render("~/bundles/jquery") &lt;script src="/scripts/kendo/2012.3.1114/kendo.core.min.js"&gt;&lt;/script&gt; &lt;script src="~/Scripts/kendo/2012.3.1114/kendo.data.min.js"&gt;&lt;/script&gt; &lt;script src="~/Scripts/kendo/2012.3.1114/kendo.grid.min.js"&gt;&lt;/script&gt; @RenderSection("scripts", required: false) &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload