Skip to content

Commit

Permalink
Merge pull request #48 from stfalcon-studio/master
Browse files Browse the repository at this point in the history
api improvement was added
  • Loading branch information
fredguile authored Jun 13, 2017
2 parents 03612b5 + bfcacc8 commit eeaaf64
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ Here's the pagination component:
[itemsCount]="700"
[itemsPerPageChoices]="[5,10,20,50]"
[itemsPerPageFirstChoice]="10"

[needShowFirstArrow]="true"
[needShowLastArrow]="true"
ofText="of"
rowsPerPageText="Rows per page:"
>
</ng2-md-datatable-pagination>
```
Expand Down
12 changes: 8 additions & 4 deletions src/lib/md-datatable-pagination.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import { IDatatablePaginationEvent } from './md-datatable.interfaces';
@Component({
selector: 'ng2-md-datatable-pagination',
template: `
<span>Rows per page:</span>
<span>{{rowsPerPageText}}</span>
<md-select [ngModel]="itemsPerPage" (change)="onSelectChange($event)" class="pagination__itemsPerPage">
<md-option *ngFor="let choice of itemsPerPageChoices"
[value]="choice">{{ choice }}</md-option>
</md-select>
<span class="pagination__range">{{firstIndexOfPage}}-{{lastIndexOfPage}} of {{itemsCount}}</span>
<span class="pagination__range">{{firstIndexOfPage}}{{lastIndexOfPage}} {{ofText}} {{itemsCount}}</span>
<div class="pagination__controls">
<button md-icon-button
<button *ngIf="needShowFirstArrow" md-icon-button
[disabled]="isPreviousOrFirstButtonDisabled"
(click)="onClickFirst()"
aria-label="First">
Expand All @@ -41,7 +41,7 @@ import { IDatatablePaginationEvent } from './md-datatable.interfaces';
aria-label="Next">
<md-icon>navigate_next</md-icon>
</button>
<button md-icon-button
<button *ngIf="needShowLastArrow" md-icon-button
[disabled]="isNextOrLastButtonDisabled"
(click)="onClickLast()"
aria-label="Last">
Expand All @@ -58,6 +58,10 @@ export class MdDataTablePaginationComponent extends BaseComponent implements OnI
@Input() itemsCount: number;
@Input() itemsPerPageChoices: Array<number> = [5, 10, 20, 50];
@Input() itemsPerPageFirstChoice = 10;
@Input() needShowFirstArrow = true;
@Input() needShowLastArrow = true;
@Input() ofText = 'of';
@Input() rowsPerPageText = 'Rows per page:';

@Output() paginationChange: EventEmitter<IDatatablePaginationEvent> =
new EventEmitter<IDatatablePaginationEvent>(true);
Expand Down

0 comments on commit eeaaf64

Please sign in to comment.