ing
This commit is contained in:
parent
0bffcfb03b
commit
a1b513f766
|
@ -30,7 +30,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-table>
|
</p-table>
|
||||||
<p-paginator #paginator [rows]="targetPage.size" [totalRecords]="targetPage.totalElements"
|
<p-paginator #paginator [rows]="targetPage.size" [totalRecords]="targetPage.totalElements" [first]="pageIdx"
|
||||||
(onPageChange)="onPaginate($event)"></p-paginator>
|
(onPageChange)="onPaginate($event)"></p-paginator>
|
||||||
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
|
@ -54,28 +54,28 @@ export class ListComponent implements OnInit, OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.location.onPopState(() => {
|
|
||||||
// alert(window.location);
|
|
||||||
this.paginator.changePage(this.pageIdx);
|
|
||||||
});
|
|
||||||
this.getTargetList();
|
this.getTargetList();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
// console.log(changes);
|
// console.log(changes);
|
||||||
if (changes['pageIdx'] && this.paginator) {
|
if (changes['pageIdx']) {
|
||||||
// console.log(this.pageIdx);
|
// console.log(this.pageIdx);
|
||||||
this.getTargetList();
|
this.getTargetList();
|
||||||
this.paginator.changePage(this.pageIdx);
|
// const p: number = this.pageIdx - 1;
|
||||||
|
// this.paginator.changePage(this.pageIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTargetList() {
|
private getTargetList() {
|
||||||
if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) {
|
if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) {
|
||||||
this.pageIdx = 0;
|
this.pageIdx = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const p: number = this.pageIdx - 1;
|
||||||
|
|
||||||
const pageParams: PageParams = {
|
const pageParams: PageParams = {
|
||||||
pageNo: this.pageIdx,
|
pageNo: p,
|
||||||
countPerPage: 2,
|
countPerPage: 2,
|
||||||
sortCol: 'id',
|
sortCol: 'id',
|
||||||
sortDirection: 'descending',
|
sortDirection: 'descending',
|
||||||
|
@ -111,6 +111,6 @@ export class ListComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
onPaginate(e) {
|
onPaginate(e) {
|
||||||
// e.changePage();
|
// e.changePage();
|
||||||
this.pageChange.emit(e.page);
|
this.pageChange.emit(Number(e.page));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,18 @@ export class TargetListPageComponent implements OnInit {
|
||||||
this.pageIdx = Number(queryParams['page']);
|
this.pageIdx = Number(queryParams['page']);
|
||||||
|
|
||||||
if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) {
|
if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) {
|
||||||
this.pageIdx = 0;
|
this.pageIdx = 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageChange(pageNo: number) {
|
onPageChange(pageNo: number) {
|
||||||
this.pageIdx = pageNo;
|
// console.log(pageNo);
|
||||||
this.router.navigate(['/probe', this.probeID, 'target'], { queryParams: { page: pageNo } });
|
// if (pageNo + 1 === this.pageIdx) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
this.pageIdx = pageNo + 1;
|
||||||
|
this.router.navigate(['/probe', this.probeID, 'target'], { queryParams: { page: this.pageIdx } });
|
||||||
}
|
}
|
||||||
|
|
||||||
onTargetSelect(target: Target) {
|
onTargetSelect(target: Target) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user