When changing steps on both editors reset the scroll

This commit is contained in:
George Kalampokis 2020-11-11 12:32:55 +02:00
parent d40265544d
commit fbff31d287
2 changed files with 14 additions and 0 deletions

View File

@ -879,14 +879,21 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
public changeStep(index: number, dataset?: FormControl) {
this.step = index;
this.resetScroll();
}
public nextStep() {
this.step = this.step < this.maxStep ? this.step + 1 : this.step;
this.resetScroll();
}
public previousStep() {
this.step = this.step !== 0 ? this.step - 1 : this.step;
this.resetScroll();
}
private resetScroll() {
document.getElementById('dataset-editor-form').scrollTop = 0;
}
isDirty() {

View File

@ -823,11 +823,13 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
public changeStep(index: number, dataset?: FormControl) {
this.step = index;
this.resetScroll();
if (dataset) { this.datasetId = dataset.get('id').value };
}
public nextStep() {
this.step = this.step < this.maxStep ? this.step + 1 : this.step;
this.resetScroll();
if (this.step >= this.stepsBeforeDatasets) {
this.datasetId = this.datasets.at(this.step - this.stepsBeforeDatasets).get('id').value;
}
@ -835,11 +837,16 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
public previousStep() {
this.step = this.step !== 0 ? this.step - 1 : this.step;
this.resetScroll();
if (this.step >= this.stepsBeforeDatasets) {
this.datasetId = this.datasets.at(this.step - this.stepsBeforeDatasets).get('id').value;
}
}
private resetScroll() {
document.getElementById('editor-form').scrollTop = 0;
}
public isDirty(): boolean {
return this.formGroup.dirty && this.hasChanges; // do we need this.formGroup.dirty
}