Skip to content

Commit

Permalink
feat(module:table and pagination): support custom the page size chang…
Browse files Browse the repository at this point in the history
…er select values(#608) (#626)

* feat(module:table and pagination): support custom the page size changer select values(#608)

* style(module:table and pagination): modify the code annotation.
close #608
  • Loading branch information
hllinc authored and vthinkxie committed Nov 28, 2017
1 parent 8f7d38b commit 034bd71
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/pagination/nz-pagination.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ export class NzPaginationComponent {
this._jumpPage(this._current + Math.round(pageSize / 2));
}

/** page size changer select values */
@Input()
set nzPageSizeSelectorValues(value: any) {
if (value) {
this._options = value;
}
}


@Input()
get nzPageIndex(): number {
Expand Down
3 changes: 3 additions & 0 deletions src/components/table/nz-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import { NzThDirective } from './nz-th.directive';
*ngIf="nzIsPagination&&data.length"
class="ant-table-pagination"
[nzShowSizeChanger]="nzShowSizeChanger"
[nzPageSizeSelectorValues]="nzPageSizeSelectorValues"
[nzShowQuickJumper]="nzShowQuickJumper"
[nzShowTotal]="nzShowTotal"
[nzSize]="(nzSize=='middle'||nzSize=='small')?'small':''"
Expand Down Expand Up @@ -112,6 +113,8 @@ export class NzTableComponent implements AfterViewInit, OnInit {
@Input() nzShowFooter = false;
@Input() nzShowTitle = false;
@Input() nzIsPageIndexReset = true;
/** page size changer select values */
@Input() nzPageSizeSelectorValues = [10, 20, 30, 40, 50];
@ContentChild('nzFixedHeader') fixedHeader: TemplateRef<any>;

@ContentChildren(NzThDirective, { descendants: true })
Expand Down
6 changes: 6 additions & 0 deletions src/showcase/nz-demo-pagination/nz-demo-pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ <h2 id="API"><span>API</span>
<td>attribute</td>
<td>-</td>
</tr>
<tr>
<td>nzPageSizeSelectorValues</td>
<td>每页显示条目数下拉框值</td>
<td>Array</td>
<td>[10, 20, 30, 40, 50]</td>
</tr>
<tr>
<td>nzShowQuickJumper</td>
<td>是否可以快速跳转至某页,当添加该属性时显示快速跳转</td>
Expand Down
6 changes: 6 additions & 0 deletions src/showcase/nz-demo-table/nz-demo-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ <h3><span>nz-table</span>
<td>Boolean</td>
<td>false</td>
</tr>
<tr>
<td>nzPageSizeSelectorValues</td>
<td>pagination中每页显示条目数下拉框值</td>
<td>Array</td>
<td>[10, 20, 30, 40, 50]</td>
</tr>
<tr>
<td>nzShowQuickJumper</td>
<td>是否显示pagination中快速跳转</td>
Expand Down

0 comments on commit 034bd71

Please sign in to comment.