From 2e8038c7005a626d2e9fd8a8c8a052c5d8d124a6 Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Wed, 1 Dec 2021 11:33:00 +0100
Subject: [PATCH] Fix dropList value on element drop

Now correctly used the value of the dropped element.
---
 .../drop-list-simple/drop-list-simple.component.ts            | 4 ++--
 projects/common/ui-elements/drop-list/drop-list.component.ts  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/projects/common/ui-elements/drop-list-simple/drop-list-simple.component.ts b/projects/common/ui-elements/drop-list-simple/drop-list-simple.component.ts
index 807b1d36e..463c5abb4 100644
--- a/projects/common/ui-elements/drop-list-simple/drop-list-simple.component.ts
+++ b/projects/common/ui-elements/drop-list-simple/drop-list-simple.component.ts
@@ -93,10 +93,10 @@ export class DropListSimpleComponent extends FormElementComponent {
           event.currentIndex
         );
         event.previousContainer.data.elementFormControl.setValue(
-          (event.previousContainer.data.elementModel.value as DragNDropValueObject).id
+          (event.item.data.elementModel.value as DragNDropValueObject).id
         );
       }
-      this.elementFormControl.setValue((event.container.data.elementModel.value as DragNDropValueObject).id);
+      this.elementFormControl.setValue((event.item.data.elementModel.value as DragNDropValueObject).id);
     }
   }
 
diff --git a/projects/common/ui-elements/drop-list/drop-list.component.ts b/projects/common/ui-elements/drop-list/drop-list.component.ts
index 8cdd16abe..1d8daba50 100644
--- a/projects/common/ui-elements/drop-list/drop-list.component.ts
+++ b/projects/common/ui-elements/drop-list/drop-list.component.ts
@@ -103,10 +103,10 @@ export class DropListComponent extends FormElementComponent {
           event.currentIndex
         );
         event.previousContainer.data.elementFormControl.setValue(
-          (event.previousContainer.data.elementModel.value as DragNDropValueObject).id
+          (event.item.data.elementModel.value as DragNDropValueObject).id
         );
       }
-      this.elementFormControl.setValue((event.container.data.elementModel.value as DragNDropValueObject).id);
+      this.elementFormControl.setValue(event.item.data.elementModel.value.id);
     }
   }
 
-- 
GitLab