Muddu Patil
Muddu Patil

Reputation: 721

Not able to set page count for ng-Table

I'm trying to set the page count to 5 in ng-Table, but its not working it displays whole content of list. Below is my code

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();
            }
        });

Can any one have clue what i'm doing wrong here?

Upvotes: 2

Views: 4307

Answers (1)

sch
sch

Reputation: 1388

A while ago I had the same problem as you, but I downloaded the most recent version of ng-Table, and followed their guidelines, this is what I have now:

    $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);
    }

Pretty much the same as they have on their site

Upvotes: 1

Related Questions