UI 网格在无限滚动中多次只显示最后一条记录

UI Grid showing only last record many times on infinite scroll

Before Scrolling

After Scrolling

在第一次加载网格时,我正在正确获取数据。 向下滚动后出现问题。 它显示每行中第一个加载的最后一条记录的最后一条记录。

下面是我的无限滚动功能的代码。

$scope.getDataDown = function() {
  var promise = $q.defer();
  $scope.lastPage++;
  if ($scope.data.length < $scope.total) {
    $http(getRequest()).success(function(data) {
      promise.resolve();
      var jb = JSON.stringify(data.content);
      $scope.gridApi.infiniteScroll.saveScrollPercentage();
      $scope.data = $scope.data.concat(data.content);
      $scope.total = data.total ? data.total : data.length;
      $scope.length = $scope.data.length;
      $scope.gridApi.infiniteScroll.dataLoaded(false,
          $scope.lastPage < ($scope.total / $scope.pageSize));
    }).error(function(error) {
          $scope.gridApi.infiniteScroll.dataLoaded();
        });
  }
  return promise.promise;
};

我明白了。函数是正确的,但我在我的代码中使用了下面的函数,它与这个函数冲突

$scope.gridOptions.rowIdentity = function(row) { return row.id; };