Note that there are some explanatory texts on larger screens.

plurals
  1. POSample Grid with ko in MVC4
    primarykey
    data
    text
    <p>I am new to MVC4 and Knockout. I am starting with a grid. so I have copied everything from this URL : <a href="http://knockoutjs.com/examples/grid.html" rel="nofollow">http://knockoutjs.com/examples/grid.html</a></p> <p>so here is my js file.</p> <pre><code> $(document).ready(function () { ko.applyBindings(new PagedGridModel(initialData)); }); var initialData = [ { name: "Well-Travelled Kitten", sales: 352, price: 75.95 }, { name: "Speedy Coyote", sales: 89, price: 190.00 }, { name: "Furious Lizard", sales: 152, price: 25.00 }, { name: "Indifferent Monkey", sales: 1, price: 99.95 }, { name: "Brooding Dragon", sales: 0, price: 6350 }, { name: "Ingenious Tadpole", sales: 39450, price: 0.35 }, { name: "Optimistic Snail", sales: 420, price: 1.50 } ]; var PagedGridModel = function (items) { this.items = ko.observableArray(items); this.gridViewModel = new ko.simpleGrid.viewModel({ data: this.items, columns: [ { headerText: "Item Name", rowText: "name" } ], pageSize: 4 }); }; </code></pre> <p>here is my cshtml</p> <pre><code> &lt;link href="../../Content/list/list.css" rel="stylesheet" type="text/css" /&gt; &lt;script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"&gt; &lt;/script&gt; &lt;script src="../../Scripts/knockout-1.3.0beta.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="../../Scripts/list/list.js" type="text/javascript"&gt;&lt;/script&gt; &lt;div class='liveExample'&gt; &lt;div data-bind='simpleGrid: gridViewModel'&gt; &lt;/div&gt; &lt;button data-bind='click: addItem'&gt; Add item &lt;/button&gt; &lt;button data-bind='click: sortByName'&gt; Sort by name &lt;/button&gt; &lt;button data-bind='click: jumpToFirstPage, enable: gridViewModel.currentPageIndex'&gt; Jump to first page &lt;/button&gt; &lt;/div&gt;​ </code></pre> <p>"ko.simpleGrid" is getting undfined so Its saying that *<em>can not read property 'viewModel' of undefind *</em> . what might be the cause ?</p> <p>Thanks for any help.</p>
    singulars
    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.
    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