From 07e595fa4e542830b7731efc6b7116d8c01e2f75 Mon Sep 17 00:00:00 2001
From: Bob Zeleznik <zzzman@gmail.com>
Date: Mon, 10 Feb 2020 00:25:09 -0500
Subject: made slider range filters persistent.

---
 src/client/views/collections/CollectionTimeView.tsx | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'src/client/views/collections/CollectionTimeView.tsx')

diff --git a/src/client/views/collections/CollectionTimeView.tsx b/src/client/views/collections/CollectionTimeView.tsx
index 861ee0dbb..487e98b33 100644
--- a/src/client/views/collections/CollectionTimeView.tsx
+++ b/src/client/views/collections/CollectionTimeView.tsx
@@ -97,21 +97,19 @@ export class CollectionTimeView extends CollectionSubView(doc => doc) {
                     }
                 });
                 if (nonNumbers / allCollectionDocs.length < .1) {
+                    const ranged = Doc.readDocRangeFilter(this.props.Document, facetHeader);
                     const newFacet = Docs.Create.SliderDocument({ title: facetHeader });
                     Doc.GetProto(newFacet).type = DocumentType.COL; // forces item to show an open/close button instead ofa checkbox
                     newFacet.treeViewExpandedView = "layout";
                     newFacet.treeViewOpen = true;
-                    newFacet._sliderMin = minVal;
-                    newFacet._sliderMax = maxVal;
+                    newFacet._sliderMin = ranged === undefined ? minVal : ranged[0];
+                    newFacet._sliderMax = ranged === undefined ? maxVal : ranged[1];
                     newFacet._sliderMinThumb = minVal;
                     newFacet._sliderMaxThumb = maxVal;
                     newFacet.target = this.props.Document;
                     const scriptText = `setDocFilterRange(this.target, "${facetHeader}", range)`;
                     newFacet.onThumbChanged = ScriptField.MakeScript(scriptText, { this: Doc.name, range: "number" });
 
-                    // const capturedVariables = { layoutDoc: this.props.Document, dataDoc: this.dataDoc };
-                    // const params = { layoutDoc: Doc.name, dataDoc: Doc.name, };
-                    // newFacet.data = ComputedField.MakeFunction(`readFacetData(layoutDoc, dataDoc, "${this.props.fieldKey}", "${facetHeader}")`, params, capturedVariables);
                     Doc.AddDocToList(facetCollection, "data", newFacet);
                 } else {
                     const newFacet = Docs.Create.TreeDocument([], { title: facetHeader, treeViewOpen: true, isFacetFilter: true });
-- 
cgit v1.2.3-70-g09d2

