dirPagination - pagination not working with tbody and dynamic rowspan ?

110 views
Skip to first unread message

Ahmed Amen

unread,
Jul 2, 2015, 2:14:00 PM7/2/15
to ang...@googlegroups.com

Hi

i try to use dirPagination with my design but it's not working - in my code i pass rowspan dynamically to group each month day's in one row to get final result as:

HTML Code:

<div class="panel panel-default panel-hovered panel-stacked mb20">
    <div class="panel-heading" style="font-size:15px;">عرض العملاء الغير جاهزين</div>
    <div class="panel-body" dir="rtl" ng-app="jqanim" ng-controller="InvoiceController">
        <input type="text"
               class="form-control input-sm ng-pristine ng-valid ng-touched"
               placeholder="اكتب جزء من الاسم او المدينة او النوع او التاريخ ..."
               tabindex="0"
               aria-invalid="false"
               ng-model="searchText">
        <br />
        <br />
        <table class="table table-bordered">
            <thead>
                <tr class="text-center">
                    <td>الشهر</td>
                    <td>العميل</td>
                    <td>المدينة</td>
                    <td>النوع</td>
                    <td>التاريخ</td>
                </tr>
            </thead>
            <tbody dir-paginate="customer in customersByMonth | itemsPerPage: 2">
                <tr ng-repeat='cust in customer | filter:searchText'>
                    <td ng-if="$first" rowspan="{{customer.length}}" class="text-center">
                        {{cust.MirageDate | date: 'yyyy-MM'}}
                    </td>
                    <td>{{cust.CustomerName}}</td>
                    <td class="text-center">{{cust.City.CityName}}</td>
                    <td class="text-center">{{cust.Type.TypeName}}</td>
                    <td class="text-center">{{cust.MirageDate | date: 'yyyy-MM-dd'}}</td>
                </tr>
            </tbody>
        </table>
        <div class="text-center">
            <dir-pagination-controls boundary-links="true" template-url="/dirPagination.tpl.html"></dir-pagination-controls>
        </div>
    </div>
</div>

JS Code:

<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;

                                   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>

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

as you can see nothing happend - i just need to display 2 tbody in each page

Really hope to find help about that i spend more than 3 days try to make it works but nothing :( - so please how can i make it works

Thanks a lot ....

Reply all
Reply to author
Forward
0 new messages