locked
ngtable - i do all steps but pagination don't work with my table ? RRS feed

  • Question

  • User-1846805900 posted

    Hi

    i try to use ngtable to do pagination for data i got i just need to display 2 tbody in each page - i got it as:

    but nothing happend when i click on page no like (1,2,3 ... )

    i have add sample project on: http://plnkr.co/edit/hr9zj6WMW0G6oRWOxC63?p=preview

    so please can i know how can i make it works ?

    Sunday, July 5, 2015 8:09 AM

Answers

  • User-1846805900 posted

    i finally did it - i have change my js code and html code 

    Thanks all ...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 12, 2015 8:09 PM

All replies

  • User2024324573 posted
    the paging on the Plunker link doesn't work either.
    Sunday, July 5, 2015 8:21 PM
  • User-1846805900 posted

    yes, i ask how can i make it work - i don't know what i'm missing here ?

    Sunday, July 5, 2015 8:56 PM
  • User-1664007096 posted

    ngtable - i do all steps but pagination don't work with my table ?

    Thanks for your post.
    As per this case, please try to set "$scope.itemsPerPage" attribute , code below is for your reference:

    <script>
        var app = angular.module('jqanim', []);
    
        app.controller('InvoiceController', [
                           '$scope', '$http', function ($scope, $http) {
                               $http.get("/api/NoReady")
                                   .success(function (data) {
                                       var dataByMonth = {};
                                       data.forEach(itemToMonth);
                                       $scope.customersByMonth = dataByMonth;
                                       $scope.itemsPerPage = 2;
                                       function itemToMonth(item) {
                                           item.MirageDate = new Date(item.MirageDate)
                                           var month = item.MirageDate.getMonth();
                                           var year = item.MirageDate.getFullYear();
                                           dataByMonth[year + '-' + month] = dataByMonth[year + '-' + month] || [];
                                           dataByMonth[year + '-' + month].push(item);
                                       }
                                   });
                           }
        ]);
    </script>

    And after that ,you could modify "dir-paginate" attribute like:

    <tbody dir-paginate="customer in customersByMonth">

    For more information ,please refer to code link below:

    http://jsfiddle.net/SAWsA/1754/

    Tuesday, July 7, 2015 10:03 PM
  • User-1846805900 posted

    i finally did it - i have change my js code and html code 

    Thanks all ...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 12, 2015 8:09 PM