From 6c8d8cdfa5840d2c0f2d123c636f24e291dc1d6e Mon Sep 17 00:00:00 2001
From: pkupczyk <piotr.kupczyk@id.ethz.ch>
Date: Fri, 3 Dec 2021 12:08:45 +0100
Subject: [PATCH] SSDM-12024 : Table Widget : Global filter with AND/OR options
 (as in the old grid) - store global filter operator in the grid settings

---
 .../src/js/components/common/grid/GridController.js    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/openbis_ng_ui/src/js/components/common/grid/GridController.js b/openbis_ng_ui/src/js/components/common/grid/GridController.js
index cb051ac674c..cb869613706 100644
--- a/openbis_ng_ui/src/js/components/common/grid/GridController.js
+++ b/openbis_ng_ui/src/js/components/common/grid/GridController.js
@@ -724,12 +724,12 @@ export default class GridController {
     )
   }
 
-  async handleGlobalFilterChange(globalFilter) {
-    const { local } = this.context.getState()
+  async handleGlobalFilterChange(newGlobalFilter) {
+    const { local, globalFilter } = this.context.getState()
 
     await this.context.setState(() => ({
       page: 0,
-      globalFilter
+      globalFilter: newGlobalFilter
     }))
 
     if (this.loadTimerId) {
@@ -743,6 +743,10 @@ export default class GridController {
       },
       local ? LOCAL_GRID_RELOAD_PERIOD : REMOTE_GRID_RELOAD_PERIOD
     )
+
+    if (globalFilter.operator !== newGlobalFilter.operator) {
+      await this._saveSettings()
+    }
   }
 
   async handleColumnVisibleChange(name) {
-- 
GitLab