以下是我对以下代码中的 if 条件的理解:
$scope.pagingOptions = {
pageSizes: [250, 500, 1000],
pageSize: 250,
currentPage: 1
};
$scope.$watch('pagingOptions', function (newVal, oldVal) {
if (newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
$scope.getPagedDataAsync($scope.pagingOptions.pageSize, $scope.pagingOptions.currentPage, $scope.filterOptions.filterText);
}
}, true);
每当pagingOptions更改和currentPage属性发生更改时, 条件if变为 true,因此该getPagedDataAsync方法被执行。
currentPage但即使我不更改pageSizeUI 中的 ,网格也会刷新。我不希望发生这种情况(根据我的理解)。那么为什么该网格会被刷新呢?
从这里,我获取了代码:
http://angular-ui.github.io/ng-grid/ 带有服务器端分页示例标题