8

I want to try the simpleGrid in a HotTowel project. When it came to:

this.gridViewModel = new ko.simpleGrid.viewModel({
        data: this.items, ....

it threw an exception:

Unable to get property 'viewModel' of undefined or null reference`

I stepped through and found that ko.simpleGrid is undefined.

Must any other files be added or is simpleGrid available from the standard Knockout.js library?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Old Geezer
  • 14,854
  • 31
  • 111
  • 198
  • 7
    Simplegird is not built in. You need to download and include it: http://knockoutjs.com/examples/resources/knockout.simpleGrid.1.3.js – nemesv Aug 29 '13 at 10:02
  • nevesv's link is old ... better to go to the [Knockout grid example page](http://knockoutjs.com/examples/grid.html), click the jsFiddle link at the bottom, then in the jsFiddle expand the External Resources in the left nav. There should be a link to the simpleGrid js file. As of October 2017 it is knockout.simpleGrid.3.0.js. Incidentally, I also think it's a big omission that this wasn't mentioned on their example page. – Roger Oct 18 '17 at 21:31

1 Answers1

8

Check the fiddle (http://jsfiddle.net/rniemeyer/QSRBR/) provides in the Simple Grid sample. It need the KO library + knockout.simpleGrid.1.3.js

And you need to define the PageGridModel

ko.applyBindings(new PagedGridModel(initialData));
Jonathan Anctil
  • 1,025
  • 3
  • 20
  • 44