Ag-grid server side row model infinite getRows loop in AngularJS 1.x

Viewed 1226

I am returning a number of rows from the server, as well as the lastRowIndex (which is -1, more records exist than are being displayed). The column definition is built and the column headers appear in my grid, but the row data is never populated and the getRows function gets called infinitely.

grid options screenshot

    EnterpriseDatasource.prototype.getRows = function (params) {
        var requestParams = JSON.stringify(params.request);

        Service.ServerSideRowRequestForServer(requestParams)
            .then(function (response) {
                var res = JSON.parse(response);
                //res[0]   = table data
                //res[1]   = lastRowIndex

                //Send first row of returned data to generate column definitions
                buildColumnDefs(res[0][0]);
                //Set row and column data for ag grid
                $scope.gridOptions.api.setColumnDefs(columnDefs);
                params.successCallback(res[0], res[1]);
            }, function (error) {
                toaster.pop('error', 'Error: ', error.data, 3000);
            });
    };

These are my grid options

1 Answers

Ok, I think I fixed it. Since I was generating the column definitions on the fly I think it was refreshing the view constantly. I added the following to my gridOptions after digging through the un-minified source code and seeing they added a 'hack for one customer'

suppressEnterpriseResetOnNewColumns: true

Related