-1

The wijmo grid setup to get its data from a knockout observableArray in the following fiddle http://jsfiddle.net/t316/K3GMR/7/ is not initializing itself properly, i.e. you see no grid.

This is happening because of an error:

"Uncaught TypeError: Object function d(){if(0<arguments.length){if(!d.equalityComparer||!d.equalityComparer(c,arguments[0]))d.H(),c=arguments[0],d.G();return this}b.r.Wa(d);return c} has no method 'load' "

Wijmo grid is supposed to be able be bound to a knockout observableArray in the manner I am trying, is it not? Why is the grid not initializing properly and not showing the small sample data?

t316
  • 1,149
  • 1
  • 15
  • 28
  • Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. – nemesv Jul 10 '13 at 18:54

1 Answers1

1

Here is the correct way of binding a wijgrid with KO observable array. The following code goes into the script section:

    var viewModel = {
        data: ko.observableArray([
          { "Name": "a" },
          { "Name": "b" }
        ])
    };

    //Bind ViewModel
    $(document).ready(function () {
        ko.applyBindings(viewModel);
    });

The HTML table can be defined like below:

<table id="dataGrid" data-bind="wijgrid: { data: data, columns : [ { headerText : 'Name'}],
    ensureControl : true} ">
</table>

Hope this helps..

Sankalp1984
  • 427
  • 5
  • 14
  • Thank you for that. This did indeed solve my problem. Two quick questions: 1) installing wijmo from nuget installs 2.4.1 – that’s where I got my outdated wijmo from. Am I doing something wrong? 2) I originally started my sample the mvvm way and couldn't get it to work – I prefer the mvvm way, but out of curiosity can you not bind to an observablearray with the jquery plugin initialization way, using data: … option? – t316 Jul 12 '13 at 12:44