scroll to top on page change
This commit is contained in:
parent
a6a629f2fe
commit
3fa6ffdec1
2 changed files with 7 additions and 3 deletions
|
@ -101,7 +101,7 @@
|
|||
</form>
|
||||
</div>
|
||||
<div class="tabContainer" *ngIf="!isLoading; else spinner">
|
||||
<table class="callsTable" mat-table [dataSource]="callsResult">
|
||||
<table #callsTable class="callsTable" mat-table [dataSource]="callsResult">
|
||||
<ng-container matColumnDef="select">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
<mat-checkbox
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Component, inject, ViewChild } from '@angular/core';
|
||||
import { Component, ElementRef, inject, ViewChild } from '@angular/core';
|
||||
import { CommonModule, AsyncPipe } from '@angular/common';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTable, MatTableModule } from '@angular/material/table';
|
||||
import {
|
||||
MatPaginator,
|
||||
MatPaginatorModule,
|
||||
|
@ -80,6 +80,7 @@ const reqPageSize = 200;
|
|||
export class CallsComponent {
|
||||
callsResult = new BehaviorSubject(new Array<CallRecord>(0));
|
||||
@ViewChild('paginator') paginator!: MatPaginator;
|
||||
@ViewChild('callsTable', { read: ElementRef }) callsTable!: ElementRef;
|
||||
count = 0;
|
||||
dialog = inject(MatDialog);
|
||||
page = 0;
|
||||
|
@ -188,6 +189,9 @@ export class CallsComponent {
|
|||
setPage(p: PageEvent, force?: boolean) {
|
||||
this.selection.clear();
|
||||
this.curPage = p;
|
||||
if (this.callsTable) {
|
||||
this.callsTable.nativeElement.scrollIntoView(true);
|
||||
}
|
||||
if (p && p!.pageSize != this.perPage) {
|
||||
this.perPage = p!.pageSize;
|
||||
this.prefsSvc.set('callsPerPage', p!.pageSize);
|
||||
|
|
Loading…
Add table
Reference in a new issue