Javascript 定向分页-使用tbody和dynamic rowspan时分页不起作用?
我尝试在我的设计中使用dirPagination,但它不起作用-在我的代码中,我将rowspan动态传递到每个月的一行中,以获得最终结果,如下所示: HTML代码:Javascript 定向分页-使用tbody和dynamic rowspan时分页不起作用?,javascript,angularjs,angularjs-ng-repeat,dirpagination,Javascript,Angularjs,Angularjs Ng Repeat,Dirpagination,我尝试在我的设计中使用dirPagination,但它不起作用-在我的代码中,我将rowspan动态传递到每个月的一行中,以获得最终结果,如下所示: HTML代码: <div class="panel panel-default panel-hovered panel-stacked mb20"> <div class="panel-heading" style="font-size:15px;">عرض العملاء الغير جاهزين</div>
<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>
عرض العملاء الغير جاهزين
الشهر
العميل
المدينة
النوع
التاريخ
{{cust.MirageDate}日期:'yyyy-MM'}
{{cust.CustomerName}
{{cust.City.CityName}
{{cust.Type.TypeName}
{{cust.MirageDate}日期:'yyyy-MM-dd'}
JS代码:
<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);
}
});
}
]);
var app=angular.module('jqanim',[]);
应用程序控制器(“发票控制器”[
“$scope”,“$http”,函数($scope,$http){
$http.get(“/api/NoReady”)
.成功(功能(数据){
var-dataByMonth={};
数据。forEach(itemToMonth);
$scope.customersByMonth=dataByMonth;
功能项第个(项){
item.MirageDate=新日期(item.MirageDate)
var month=item.MirageDate.getMonth();
var year=item.MirageDate.getFullYear();
数据月[年+'-'+月]=数据月[年+'-'+月]| |[];
数据月[年+'-'+月]。推送(项目);
}
});
}
]);
plnkr上的示例项目:
正如您所看到的,没有发生任何事情-我只需要在每个页面中显示2个tbody标准表应该有一个
标记
尝试在
标记上使用dir paginat
,然后使用ng init
创建一个要动态显示的值