Refactoring: fix filters, remove obsolete code

This commit is contained in:
Pieter Vander Vennet 2023-04-06 02:20:25 +02:00
parent 0241f89d3d
commit 97aaa8e941
9 changed files with 122 additions and 302 deletions

View file

@ -144,10 +144,12 @@ export default class FilterConfig {
})
}
public initState(): UIEventSource<undefined | number | string> {
public initState(layerId: string): UIEventSource<undefined | number | string> {
let defaultValue = ""
if (this.options.length > 1) {
defaultValue = "" + (this.defaultSelection ?? 0)
} else if (this.options[0].fields?.length > 0) {
defaultValue = "{}"
} else {
// Only a single option
if (this.defaultSelection === 0) {
@ -157,7 +159,7 @@ export default class FilterConfig {
}
}
const qp = QueryParameters.GetQueryParameter(
"filter-" + this.id,
`filter-${layerId}-${this.id}`,
defaultValue,
"State of filter " + this.id
)