Samples get now loaded according to page.
This commit is contained in:
parent
ad20fdb1bb
commit
42b9eb979a
@ -105,7 +105,7 @@ export class SamplesComponent implements OnInit {
|
|||||||
const onLoad = () => {
|
const onLoad = () => {
|
||||||
if ((--this.loading) <= 0) {
|
if ((--this.loading) <= 0) {
|
||||||
this.loadSamples();
|
this.loadSamples();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.calcFieldSelectKeys();
|
this.calcFieldSelectKeys();
|
||||||
@ -126,10 +126,6 @@ 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) {
|
||||||
@ -210,6 +206,9 @@ export class SamplesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if(this.storage.get('currentPage') !== this.page){
|
||||||
|
this.loadPage(Number(this.storage.get('currentPage')) - this.page);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sampleUrl(options: {
|
sampleUrl(options: {
|
||||||
@ -303,11 +302,11 @@ export class SamplesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadPage(delta) {
|
loadPage(delta) {
|
||||||
if (!/[0-9]+/.test(delta) || this.page + delta < 1 || this.page + delta > this.pages) { // invalid delta
|
if (!/[0-9]+/.test(delta) || this.page + delta < 1) { // invalid delta
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.page += delta;
|
this.page += delta;
|
||||||
localStorage.setItem("currentPage", this.page.toString());
|
this.storage.set('currentPage', this.page);
|
||||||
this.loadSamples({toPage: delta});
|
this.loadSamples({toPage: delta});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user