diff options
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index e64195b63..e26d771d3 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1063,9 +1063,10 @@ export namespace Doc { // filters document in a container collection: // all documents with the specified value for the specified key are included/excluded // based on the modifiers :"check", "x", undefined - export function setDocFilter(target: Opt<Doc>, key: string, value: any, modifiers: "remove" | "match" | "check" | "x", toggle?: boolean) { + export function setDocFilter(target: Opt<Doc>, key: string, value: any, modifiers: "remove" | "match" | "check" | "x", toggle?: boolean, fieldSuffix?:string) { const container = target ?? CollectionDockingView.Instance.props.Document; - const docFilters = Cast(container._docFilters, listSpec("string"), []); + const filterField = "_"+(fieldSuffix ? fieldSuffix+"-":"")+"docFilters"; + const docFilters = Cast(container[filterField], listSpec("string"), []); runInAction(() => { for (let i = 0; i < docFilters.length; i++) { const fields = docFilters[i].split(":"); // split key:value:modifier @@ -1075,15 +1076,15 @@ export namespace Doc { else return; } docFilters.splice(i, 1); - container._docFilters = new List<string>(docFilters); + container[filterField] = new List<string>(docFilters); break; } } if (!docFilters.length && modifiers === "match" && value === undefined) { - container._docFilters = undefined; + container[filterField] = undefined; } else if (modifiers !== "remove") { docFilters.push(key + ":" + value + ":" + modifiers); - container._docFilters = new List<string>(docFilters); + container[filterField] = new List<string>(docFilters); } }); } |