ng-table过滤器不过滤所有页面

时间:2017-03-12 09:52:42

标签: angularjs ngtable

我正在处理角度应用程序,我正在使用<a class="colorbox cboxElement" href="http://example.com">Diablo</a>进行网格功能,但我遇到了两个问题。

  1. 过滤器选项正在搜索当前页面数据而非搜索所有页面
  2. 显示错误计数的总计数及其十进制
  3. 这是屏幕截图

    enter image description here

    JS文件如下:

    ng-table

    Html如下

    app.controller('AllJobListController', function 
    ($scope, $http, $location, $filter, NgTableParams, jobService, ShareData, $sce) {
        loadAllJobRecords();
        GetFilterData();
        function GetFilterData() {
            var promiseFilterData = jobService.GetFilterData();
            promiseFilterData.then(function(pl) {
                $scope.FilterData = pl.data;
            });
        }
    
        $scope.viewFilter = function () {
            $scope.filters = {
                Staff: $scope.FilterData.Staff == undefined ? null : $scope.FilterData.Staff,
                Priority: $scope.FilterData.Priority == undefined ? null : $scope.FilterData.Priority,
                Manager: $scope.FilterData.Manager == undefined ? null : $scope.FilterData.Manager,
                Status: $scope.FilterData.Status == undefined ? null : $scope.FilterData.Status
            }
            $scope.tableParams.filter($scope.filters);
    
        };
    
            $scope.search = '';
    
        function loadAllJobRecords() {
            $("#divLoading").show();
            var promiseGetAllJobs = jobService.GetAllJobs();
            promiseGetAllJobs.then(function (pl) {
                $("#divLoading").hide();
                $scope.Jobs = pl.data;
                $scope.JobTitle = "All Engagements";
                $scope.Action = $sce.trustAsResourceUrl("/Job/ExportAllJobRecords");
                //  $scope.Action = "/Job/ExportAllJobRecords";
                $scope.tableParams = new NgTableParams({
                    page: 1,              // show first page
                    count: 10,             // count per page
                    sorting: {
                        JobNum: 'asc' // initial sorting
                    },
                    filter: $scope.search
    
                },
                    { dataset: pl.data },
                    {
                        total: pl.data.length,
                        getData: function ($defer, params) {
                            var filteredData = params.filter() ? $filter('filter')(pl.data, params.filter()) : pl.data;
                            var orderedData = params.sorting() ? $filter('orderBy')(filteredData, params.orderBy()) : filteredData; params.total(filteredData.length);
                            $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
                        }
                    });
            },
                  function (errorPl) {
                      $scope.error = errorPl;
                  });
        }
    
    });
    

    我搜索了过滤器问题,但无法找到解决方法。

0 个答案:

没有答案