Commit ffea53c0 authored by Jie Yuan's avatar Jie Yuan

change paging of service table

parent cef5937a
......@@ -143,7 +143,7 @@
</table>
<mat-paginator [pageSizeOptions]="[10, 20,40]" showFirstLastButtons></mat-paginator>
<mat-paginator [pageSize]="20" [pageSizeOptions]="getPageSizeOptions()" showFirstLastButtons></mat-paginator>
</div>
</mat-sidenav-content>
......
......@@ -36,6 +36,7 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
gocdbSiteNames: string[];
dpmtSiteNames: string[];
username: string;
defaultPageSizeOptions: number[] =[10,20,40,80];
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
......@@ -373,4 +374,28 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
}
getPageSizeOptions(): number[] {
//console.log(this.dataSource.data.length);
const real_length = this.dataSource.data.length;
var options = [1,2];
options = [];
for(var i = 0, len = this.defaultPageSizeOptions.length; i < len; i++){
//console.log(this.defaultPageSizeOptions[i]);
if ( this.defaultPageSizeOptions[i] <= real_length) {
options.push(this.defaultPageSizeOptions[i]);
} else {
options.push(real_length);
break;
}
}
if ( i == this.defaultPageSizeOptions.length) {
options.push(real_length);
}
//console.log(options);
return options;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment