From d385851915791fddea56b4182e33fdff911eca87 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 11 Oct 2023 08:46:27 -0400 Subject: [PATCH] save/restore initial list showTree config value --- modules/backend/widgets/Lists.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/backend/widgets/Lists.php b/modules/backend/widgets/Lists.php index 65b8d742ce..755307038a 100644 --- a/modules/backend/widgets/Lists.php +++ b/modules/backend/widgets/Lists.php @@ -1489,10 +1489,19 @@ public function addFilter(callable $filter) public function setSearchTerm($term, $resetPagination = false) { if ( - strlen($this->searchTerm) !== 0 - && trim($this->searchTerm) !== '' + strlen($term) !== 0 + && trim($term) !== '' ) { + if ($this->showTree === true) { + // save initial list config showTree value + $this->putSession('showTree', true); + } $this->showTree = false; + } else { + if ($this->getSession('showTree')) { + // restore initial list config showTree value + $this->showTree = true; + } } if ($resetPagination) {