From 7bd3fcd4904d018e78627a01022e9e3d01534962 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 6 Mar 2023 03:47:00 +0100 Subject: [PATCH] Fix filter persistence --- UI/BigComponents/FilterView.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/UI/BigComponents/FilterView.ts b/UI/BigComponents/FilterView.ts index aa4f138f7..e7bdbd59a 100644 --- a/UI/BigComponents/FilterView.ts +++ b/UI/BigComponents/FilterView.ts @@ -279,12 +279,17 @@ export class LayerFilterPanel extends Combine { const icon = Svg.checkbox_filled_svg().SetClass("block mr-2 w-6") const iconUnselected = Svg.checkbox_empty_svg().SetClass("block mr-2 w-6") - + const qp = QueryParameters.GetBooleanQueryParameter( + "filter-" + filterConfig.id, + false, + "Is filter '" + filterConfig.options[0].question.textFor("en") + " enabled?" + ) const toggle = new ClickableToggle( new Combine([icon, option.question.Clone().SetClass("block")]).SetClass("flex"), new Combine([iconUnselected, option.question.Clone().SetClass("block")]).SetClass( "flex" - ) + ), + qp ) .ToggleOnClick() .SetClass("block m-1") @@ -315,6 +320,15 @@ export class LayerFilterPanel extends Combine { state: i, })) let filterPicker: InputElement + const value = QueryParameters.GetQueryParameter( + "filter-" + filterConfig.id, + "0", + "Value for filter " + filterConfig.id + ).sync( + (str) => Number(str), + [], + (n) => "" + n + ) if (options.length <= 6) { filterPicker = new RadioButton( @@ -323,6 +337,7 @@ export class LayerFilterPanel extends Combine { new FixedInputElement(option.question.Clone().SetClass("block"), i) ), { + value, dontStyle: true, } ) @@ -332,7 +347,8 @@ export class LayerFilterPanel extends Combine { options.map((option, i) => ({ value: i, shown: option.question.Clone(), - })) + })), + value ) }