简体   繁体   English

为表Angular 2添加分页

[英]Add pagination to table Angular 2

I want to add pagination in the bottom of my own bootstrap table with angular 我想在我自己的bootstrap表底部添加分页角度
I don't want to use one of the examples of tables. 我不想使用表中的一个示例。
Can anyone help me ? 谁能帮我 ?

 <table class='table table-bordered table-striped table-responsive table-hover' id="table" style="margin-top: 2%">
  <thead>
  <tr>
    <th rowspan="2">Id boitier</th>
    <th rowspan="2">Id phase</th>
    <th rowspan="2">Power</th>
    <th colspan="3">Voltage</th>
    <th rowspan="2">Date</th>
    <th rowspan="2">Time</th>
    <th rowspan="2">Details</th>

  </tr>
  <tr>
    <th>Max</th>
    <th>Min</th>
    <th>Moy</th>
  </tr>
  </thead>
  <tbody>
  <tr *ngFor='let cursen of cursens'>
    <td >{{cursen.id_boitier}}</td>
    <td>{{cursen.id_phase}}</td>
    <td>{{cursen.power}}</td>
    <td>{{cursen.voltage.Max}}</td><td>{{cursen.voltage.Min}}</td><td>{{cursen.voltage.Moy}}</td>
    <td>{{cursen.date  | date: 'dd/MM/yyyy'}}</td>
    <td>{{cursen.date  | date:'HH:mm:ss'}}</td>
    <td><a (click)="onSelect(cursen)">alaa</a></td>
  </tr>
  </tbody>
</table>

Here is an example: 这是一个例子:

Pagination from here and then 这里开始分页

In the view: 在视图中:

<tr ng-repeat="cursen in cursens | pagination: pageNo * pageSize | limitTo: pageSize>
...
</tr>

In the js file: 在js文件中:

app.filter('pagination', function()
{
 return function(input, start)
 {
  start = +start;
  return input.slice(start);
 };
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM