ngTable筛选器仅适用于第一页

ngTable filter only works for the first page

本文关键字:适用于 第一页 筛选 ngTable      更新时间:2023-09-26

处理具有1000多条记录的ngTable。一切都很好,但我面临的唯一问题是过滤器。它只过滤活动页面中的文本。假设我在第3页,如果我使用文本框搜索/筛选某个内容,它必须来自第3页。否则它将不显示任何内容。。

我的代码如下:

    $scope.$watch("filter.$", function () {
    $scope.tableParams.reload();});

    $scope.tableParams = new ngTableParams({
        page: 1,            // show first page
        count: 10,          // count per page
        sorting: {
            schoolName: 'asc'     // initial sorting
        }
    },
{
    total: $scope.schoolInfo.length, // length of data
    getData: function ($defer, params) {
        var filteredData = {};

    //reason I am doing this is to get the data always filtered, no matter what
    var orderedData = $filter('orderBy')($scope.schoolName, params.orderBy());
         params.total(orderedData); // set total for recalc pagination
         $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
    },$scope:$scope
    });

排序非常有效,但它是只搜索的

搜索:<input type="text" ng-model="search.schoolName">我也试过ng model="search"以及

<tr ng-repeat="mydata in $data | filter:search">我也尝试过搜索:严格的

如果有人能帮我,似乎什么都帮不了?

提前感谢

从ng表中查看以下示例:组合排序和过滤的表

尝试重新编写代码以使用此示例中的代码。