Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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