我正在从服务器返回许多行,以及 lastRowIndex(为 -1,存在的记录多于显示的记录)。列定义已构建且列标题出现在我的网格中,但行数据从未填充且 getRows 函数被无限调用。
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);
});
};
这些是我的网格选项
最佳答案
好的,我想我已经解决了。因为我是在动态生成列定义,所以我认为它会不断刷新 View 。在挖掘未缩小的源代码并看到他们为一个客户添加了“hack for one customer”之后,我将以下内容添加到我的 gridOptions
suppressEnterpriseResetOnNewColumns: true
关于javascript - AngularJS 1.x 中的 Ag-grid 服务器端行模型无限 getRows 循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52321185/