ing
This commit is contained in:
parent
7a1e1bf3b6
commit
c844548d68
|
@ -50,32 +50,33 @@ export class ListComponent implements OnInit, OnChanges {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getTargetList();
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
console.log(changes);
|
||||
if (changes['pageIdx'] && this.paginator) {
|
||||
console.log(this.pageIdx);
|
||||
this.getTargetList();
|
||||
this.paginator.changePage(this.pageIdx);
|
||||
}
|
||||
}
|
||||
|
||||
private getTargetList() {
|
||||
// console.log('----------------------------------------------------------------');
|
||||
// console.log(this.pageIdx);
|
||||
// console.log('----------------------------------------------------------------');
|
||||
|
||||
if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null || isNaN(this.pageIdx)) {
|
||||
this.pageIdx = 0;
|
||||
}
|
||||
const pageParams: PageParams = {
|
||||
pageNo: 0,
|
||||
pageNo: this.pageIdx,
|
||||
countPerPage: 2,
|
||||
sortCol: 'id',
|
||||
sortDirection: 'descending',
|
||||
};
|
||||
|
||||
this.getTargetList(pageParams);
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes['pageIdx'] && this.paginator) {
|
||||
const pageParams: PageParams = {
|
||||
pageNo: this.pageIdx,
|
||||
countPerPage: 2,
|
||||
sortCol: 'id',
|
||||
sortDirection: 'descending',
|
||||
};
|
||||
console.log(this.pageIdx);
|
||||
this.paginator.changePage(this.pageIdx);
|
||||
this.getTargetList(pageParams);
|
||||
}
|
||||
}
|
||||
|
||||
private getTargetList(pageParams: PageParams) {
|
||||
|
||||
this.targetService.readAllByProbeID(this.probeID, pageParams)
|
||||
.pipe(
|
||||
tap(() => {
|
||||
|
|
|
@ -12,15 +12,27 @@ export class TargetListPageComponent implements OnInit {
|
|||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute
|
||||
private activatedRoute: ActivatedRoute
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.queryParams.subscribe(queryParams => {
|
||||
this.pageIdx = Number(queryParams['page']);
|
||||
|
||||
if (this.pageIdx <= 0 || this.pageIdx === undefined || this.pageIdx === null) {
|
||||
this.pageIdx = 0;
|
||||
}
|
||||
// console.log('*****************************************************');
|
||||
// console.log(this.pageIdx);
|
||||
// console.log('*****************************************************');
|
||||
});
|
||||
// this.pageIdx = this.activatedRoute.snapshot.queryParams['page'] || 1;
|
||||
}
|
||||
|
||||
onPageChange(pageNo: number) {
|
||||
this.pageIdx = pageNo + 1;
|
||||
this.router.navigate(['/probe', this.probeID, 'target'], { queryParams: { page: pageNo + 1 } });
|
||||
// console.log('**********************pageNo*******************************');
|
||||
// console.log(pageNo);
|
||||
// console.log('**********************pageNo*******************************');
|
||||
this.router.navigate(['/probe', this.probeID, 'target'], { queryParams: { page: pageNo } });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user