Store current sample page

This commit is contained in:
Ruben Hartenstein (PEA4-Fe) 2020-12-03 14:39:24 +01:00
parent 3526dcb049
commit 7e82b43e06

View File

@ -126,6 +126,10 @@ export class SamplesComponent implements OnInit {
this.loadTemplateKeys('material', 'type', onLoad); this.loadTemplateKeys('material', 'type', onLoad);
this.loadTemplateKeys('condition', 'notes.comment', onLoad); this.loadTemplateKeys('condition', 'notes.comment', onLoad);
this.loadTemplateKeys('measurement', 'status', onLoad); this.loadTemplateKeys('measurement', 'status', onLoad);
if("currentPage" in localStorage){
this.page = Number(localStorage.getItem("currentPage"));
}
} }
loadTemplateKeys(collection, insertBefore, f) { loadTemplateKeys(collection, insertBefore, f) {
@ -303,6 +307,7 @@ export class SamplesComponent implements OnInit {
return; return;
} }
this.page += delta; this.page += delta;
localStorage.setItem("currentPage", this.page.toString());
this.loadSamples({toPage: delta}); this.loadSamples({toPage: delta});
} }
@ -498,6 +503,4 @@ export class SamplesComponent implements OnInit {
ucFirst(string) { // convert first character of string to uppercase ucFirst(string) { // convert first character of string to uppercase
return string[0].toUpperCase() + string.slice(1); return string[0].toUpperCase() + string.slice(1);
} }
} }