Skip to content

Commit

Permalink
fixed #635
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtcndkn committed Jul 22, 2016
1 parent 5f7ce48 commit 17eed79
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 5 deletions.
6 changes: 5 additions & 1 deletion components/datagrid/datagrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import {Paginator} from '../paginator/paginator';
<div class="ui-datagrid-header ui-widget-header ui-corner-top" *ngIf="header">
<ng-content select="header"></ng-content>
</div>
<p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks"
(onPageChange)="paginate($event)" styleClass="ui-paginator-bottom" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && paginatorPosition!='bottom' || paginatorPosition =='both'"></p-paginator>
<div class="ui-datagrid-content ui-widget-content" [ngClass]="'ui-datagrid-col-' + columns">
<template ngFor [ngForOf]="dataToRender" [ngForTemplate]="itemTemplate"></template>
</div>
<p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks"
(onPageChange)="paginate($event)" styleClass="ui-paginator-bottom" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator"></p-paginator>
(onPageChange)="paginate($event)" styleClass="ui-paginator-bottom" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && paginatorPosition!='top' || paginatorPosition =='both'"></p-paginator>
<div class="ui-datagrid-footer ui-widget-header ui-corner-top" *ngIf="footer">
<ng-content select="footer"></ng-content>
</div>
Expand Down Expand Up @@ -45,6 +47,8 @@ export class DataGrid implements AfterViewInit,DoCheck {
@Input() style: any;

@Input() styleClass: string;

@Input() paginatorPosition: string = 'bottom';

@ContentChild(Header) header;

Expand Down
6 changes: 5 additions & 1 deletion components/datalist/datalist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {TemplateWrapper} from '../common';
<div class="ui-datalist-header ui-widget-header ui-corner-top" *ngIf="header">
<ng-content select="header"></ng-content>
</div>
<p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks"
(onPageChange)="paginate($event)" styleClass="ui-paginator-bottom" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && paginatorPosition!='bottom' || paginatorPosition =='both'"></p-paginator>
<div class="ui-datalist-content ui-widget-content">
<ul class="ui-datalist-data">
<li *ngFor="let item of dataToRender">
Expand All @@ -19,7 +21,7 @@ import {TemplateWrapper} from '../common';
</ul>
</div>
<p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks"
(onPageChange)="paginate($event)" styleClass="ui-paginator-bottom" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator"></p-paginator>
(onPageChange)="paginate($event)" styleClass="ui-paginator-bottom" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && paginatorPosition!='top' || paginatorPosition =='both'"></p-paginator>
<div class="ui-datalist-footer ui-widget-header ui-corner-bottom" *ngIf="footer">
<ng-content select="footer"></ng-content>
</div>
Expand Down Expand Up @@ -48,6 +50,8 @@ export class DataList implements AfterViewInit,DoCheck {
@Input() style: any;

@Input() styleClass: string;

@Input() paginatorPosition: string = 'bottom';

@ContentChild(Header) header;

Expand Down
6 changes: 5 additions & 1 deletion components/datatable/datatable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {DomHandler} from '../dom/domhandler';
<div class="ui-datatable-header ui-widget-header" *ngIf="header" [ngStyle]="{'width': scrollWidth}">
<ng-content select="header"></ng-content>
</div>
<p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks" styleClass="ui-paginator-bottom"
(onPageChange)="paginate($event)" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && paginatorPosition!='bottom' || paginatorPosition =='both'"></p-paginator>
<div class="ui-datatable-tablewrapper" *ngIf="!scrollable">
<table>
<thead>
Expand Down Expand Up @@ -142,7 +144,7 @@ import {DomHandler} from '../dom/domhandler';
</table>
</div>
<p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks" styleClass="ui-paginator-bottom"
(onPageChange)="paginate($event)" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator"></p-paginator>
(onPageChange)="paginate($event)" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && paginatorPosition!='top' || paginatorPosition =='both'"></p-paginator>
<div class="ui-datatable-footer ui-widget-header" *ngIf="footer">
<ng-content select="footer"></ng-content>
</div>
Expand Down Expand Up @@ -233,6 +235,8 @@ export class DataTable implements AfterViewChecked,AfterViewInit,OnInit,DoCheck,

@Input() emptyMessage: string = 'No records found';

@Input() paginatorPosition: string = 'bottom';

@Output() onEditInit: EventEmitter<any> = new EventEmitter();

@Output() onEditComplete: EventEmitter<any> = new EventEmitter();
Expand Down
13 changes: 11 additions & 2 deletions components/paginator/paginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export class Paginator {

@Input() rows: number = 0;

@Input() first: number = 0;

@Input() pageLinkSize: number = 5;

@Output() onPageChange: EventEmitter<any> = new EventEmitter();
Expand All @@ -50,6 +48,8 @@ export class Paginator {
pageLinks: number[];

_totalRecords: number = 0;

_first: number = 0;

@Input() get totalRecords(): number {
return this._totalRecords;
Expand All @@ -59,6 +59,15 @@ export class Paginator {
this._totalRecords = val;
this.updatePageLinks();
}

@Input() get first(): number {
return this._first;
}

set first(val:number) {
this._first = val;
this.updatePageLinks();
}

isFirstPage() {
return this.getPage() === 0;
Expand Down
6 changes: 6 additions & 0 deletions showcase/demo/datagrid/datagriddemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ <h3>Attributes</h3>
<td>null</td>
<td>Style class of the component.</td>
</tr>
<tr>
<td>paginatorPosition</td>
<td>string</td>
<td>bottom</td>
<td>Position of the paginator.</td>
</tr>
</tbody>
</table>
</div>
Expand Down
6 changes: 6 additions & 0 deletions showcase/demo/datalist/datalistdemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ <h3>Attributes</h3>
<td>null</td>
<td>Style class of the component.</td>
</tr>
<tr>
<td>paginatorPosition</td>
<td>string</td>
<td>bottom</td>
<td>Position of the paginator.</td>
</tr>
</tbody>
</table>
</div>
Expand Down
6 changes: 6 additions & 0 deletions showcase/demo/datatable/datatabledemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,12 @@ <h3>Attributes</h3>
<td>No records found.</td>
<td>Text to display when there is no data.</td>
</tr>
<tr>
<td>paginatorPosition</td>
<td>string</td>
<td>bottom</td>
<td>Position of the paginator.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit 17eed79

Please sign in to comment.