首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >dirPagination -当使用tbody和动态行跨度时,分页不起作用?

dirPagination -当使用tbody和动态行跨度时,分页不起作用?
EN

Stack Overflow用户
提问于 2015-07-02 21:41:36
回答 1查看 1.2K关注 0票数 0

我尝试在我的设计中使用dirPagination,但它不起作用-在我的代码中,我动态地传递rowspan,将每个月的每一天分组在一行中,以获得最终结果,如下所示:

https://cloud.githubusercontent.com/assets/7356190/8421324/242770f8-1ecd-11e5-8f84-fb2f47bf79d1.png

HTML代码:

代码语言:javascript
复制
<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>

JS代码:

代码语言:javascript
复制
<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);
                               }
                           });
                   }
]);

plnkr上的示例项目:http://plnkr.co/edit/hr9zj6WMW0G6oRWOxC63?p=preview

正如你可以看到什么都没有发生-我只需要在每个页面中显示2个tbody

EN

回答 1

Stack Overflow用户

发布于 2015-07-02 21:55:51

标准表应该有一个<tbody>标签。

尝试在<tr>标记上使用dir-paginat,然后使用ng-init创建一个动态显示的值。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31186268

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档