From 5b10f4ab99d22247b1e38086ac8f58656b8f5e53 Mon Sep 17 00:00:00 2001 From: Nikita Zarubin Date: Fri, 25 Sep 2020 15:20:20 +0300 Subject: [PATCH 1/3] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9f9167a..b7c37fd 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "leandrogehlen/yii2-treegrid", + "name": "nikserg/yii2-treegrid", "description": "Extension for Yii2 Framework to work with jQuery TreeGrid", "keywords": ["yii2", "tree", "treeview", "treegrid", "interface"], "type": "yii2-extension", From 1a9a86f34d9f9f0eeec2974d5bf999f6fe7e2505 Mon Sep 17 00:00:00 2001 From: Nikita Zarubin Date: Fri, 25 Sep 2020 15:21:36 +0300 Subject: [PATCH 2/3] Update TreeGrid.php --- TreeGrid.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/TreeGrid.php b/TreeGrid.php index 69b5e33..3f1930d 100644 --- a/TreeGrid.php +++ b/TreeGrid.php @@ -390,16 +390,22 @@ protected function guessColumns() /** * Normalize tree data + * * @param array $data - * @param string $parentId + * @param null $parentId + * @param array $backWalk Already passed nodes * @return array */ - protected function normalizeData(array $data, $parentId = null) { + protected function normalizeData(array $data, $parentId = null, $backWalk = []) { $result = []; foreach ($data as $element) { + if (in_array(ArrayHelper::getValue($element, $this->keyColumnName), $backWalk)) { + continue; + } if (ArrayHelper::getValue($element, $this->parentColumnName) == $parentId) { $result[] = $element; - $children = $this->normalizeData($data, ArrayHelper::getValue($element, $this->keyColumnName)); + $backWalk[] = ArrayHelper::getValue($element, $this->keyColumnName); + $children = $this->normalizeData($data, ArrayHelper::getValue($element, $this->keyColumnName), $backWalk); if ($children) { $result = array_merge($result, $children); } From 0518f541e4469b1718510ede84360c310158cb83 Mon Sep 17 00:00:00 2001 From: Nikita Zarubin Date: Mon, 28 Sep 2020 15:04:21 +0300 Subject: [PATCH 3/3] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b7c37fd..9f9167a 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "nikserg/yii2-treegrid", + "name": "leandrogehlen/yii2-treegrid", "description": "Extension for Yii2 Framework to work with jQuery TreeGrid", "keywords": ["yii2", "tree", "treeview", "treegrid", "interface"], "type": "yii2-extension",