auto scroll top on stats table change

pull/29/head
HardiReady 2018-02-26 08:53:51 +01:00
parent 2ba35167bc
commit b52c5fc484
1 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import {Component, EventEmitter, SimpleChanges} from "@angular/core";
import {Component, ElementRef, EventEmitter, SimpleChanges} from "@angular/core";
import {War} from "../../../models/model-interfaces";
import {Fraction} from "../../../utils/fraction.enum";
@ -30,10 +30,7 @@ export class ScoreboardComponent {
sortDescending: 'glyphicon glyphicon-triangle-bottom',
};
constructor() {
}
ngOnInit() {
constructor(private elRef: ElementRef) {
}
selectPlayerDetail(view: number, playerName: string) {
@ -41,6 +38,8 @@ export class ScoreboardComponent {
}
ngOnChanges(changes: SimpleChanges) {
this.elRef.nativeElement.querySelector('.datatable-body').scrollTo(0, 0);
if (changes.war) {
this.rows = changes.war.currentValue.players;
}