Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
Updating igGrid with JSON data
posted

Hi,

I am trying to reload the data in my Infragistics grid using a knockout datasource. I have got the following code:

    MYNAMESPACE.gridFunctions.prototype.refresh = function (data) {
        
        if (data == undefined) {
            $(".ajax-loader").css("display", "block");
            MYNAMESPACE.gridFunctions.prototype.read(undefined, MYNAMESPACE.gridFunctions.prototype.refresh)
            return;
        }
        MYNAMESPACE.viewModel.books = ko.mapping.fromJS($.parseJSON(data));
        ko.applyBindings(MYNAMESPACE.viewModel);
        $(".ajax-loader").css("display", "none");
    };

"MYNAMESPACE.gridFunctions.prototype.read" is a REST/AJAX function which gets JSON data from the server.

When testing the functionality it seems to work, but the second refresh I get the following error:

TypeError: g[(w + d.owner._startRowIndex)] is undefined
...ngth-1][d.options.primaryKey])}}else{if(f().length>h.length){k=f()[f().length-1]...

I have no idea what might be wrong.. anyone?

Thanks in advance.