简体   繁体   English

AngularJS 1.x中的Ag-grid服务器端行模型无限getRows循环

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

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). 我从服务器返回了许多行,以及lastRowIndex(它为-1,存在的记录多于正在显示的记录)。 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. 建立了列定义,并且列标题显示在我的网格中,但是从不填充行数据,并且无限调用getRows函数。

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 这些是我的网格选项

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' 在浏览了未缩小的源代码后,我将以下内容添加到了我的gridOptions中,并看到它们添加了“为一位客户进行黑客攻击”

suppressEnterpriseResetOnNewColumns: true rejectEnterpriseResetOnNewColumns:是

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM