无法设置ng-Table的页数

时间:2015-11-27 11:30:35

标签: angularjs ngtable

我正在尝试在ng-Table中将页面数量设置为5,但它无法正常显示列表的整个内容。以下是我的代码

self.tableParams = new NgTableParams({ 
        page: 1,   // show first page
        count: 5, // count per page
        }, 
        {
            filterDelay: 0,
            dataset: angular.copy(simpleList)
        },{
            counts: [], // hide page counts control
            total: 1,  // value less than count hide pagination
            getData: function($defer, params) {
              $defer.resolve($scope.configs.slice((params.page() - 1) * params.count(), params.page() * params.count()));
              this.current=params.count();
            }
        });

任何人都能知道我在这里做错了吗?

1 个答案:

答案 0 :(得分:1)

前段时间我和你有同样的问题,但我下载了最新版本的ng-Table,并遵循了他们的指导方针,这就是我现在所拥有的:

    $scope.customConfigParams = createUsingFullOptions();
        function createUsingFullOptions() {
            var initialParams = {
                count: 20, // initial page size
                sorting: {
                    Index: 'asc'
                },
                filter: {
                    vg: ''
                }
            };
            var initialSettings = {
                // page size buttons (right set of buttons in demo)
                counts: [],
                // determines the pager buttons (left set of buttons in demo)
                paginationMaxBlocks: 13,
                paginationMinBlocks: 2,
                dataset: $scope.itemArray
            };

        return new ngTableParams(initialParams, initialSettings);
    }

site

上的相同