Frage

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?

War es hilfreich?

Lösung

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..

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top