1
|
import { Injectable } from '@angular/core';
|
2
|
import { LazyLoadEvent } from 'primeng/api';
|
3
|
import { Table } from 'primeng/table';
|
4
|
|
5
|
@Injectable()
|
6
|
export class SearchListStateService {
|
7
|
|
8
|
private searchState: any = {};
|
9
|
private page: number ;
|
10
|
private lastPageVisit :number = -1;
|
11
|
private event: LazyLoadEvent;
|
12
|
private table : Table;
|
13
|
|
14
|
constructor() { }
|
15
|
|
16
|
public getTable() {
|
17
|
return this.table;
|
18
|
}
|
19
|
|
20
|
public setTable(table : Table) {
|
21
|
this.table = table ;
|
22
|
}
|
23
|
|
24
|
public getEvent() {
|
25
|
return this.event;
|
26
|
}
|
27
|
|
28
|
public setEvent(event : LazyLoadEvent) {
|
29
|
this.event = event ;
|
30
|
}
|
31
|
|
32
|
public getState() {
|
33
|
return this.searchState;
|
34
|
}
|
35
|
|
36
|
public setState(state: any) {
|
37
|
this.searchState = state;
|
38
|
}
|
39
|
|
40
|
public getLastPageVisit() {
|
41
|
return this.lastPageVisit;
|
42
|
}
|
43
|
|
44
|
public setLastPageVisit(page: number) {
|
45
|
this.lastPageVisit = page;
|
46
|
}
|
47
|
|
48
|
public getPage(): number {
|
49
|
return this.page;
|
50
|
}
|
51
|
|
52
|
public setPage(page: number) {
|
53
|
this.page = page;
|
54
|
}
|
55
|
|
56
|
public resetLastPage(){
|
57
|
this.lastPageVisit = -1;
|
58
|
}
|
59
|
|
60
|
public clearState() {
|
61
|
this.searchState = {};
|
62
|
this.page = null;
|
63
|
}
|
64
|
|
65
|
}
|