From 510e5e845297835f06aee5652d69379aafd56e0e Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 7 Jul 2021 13:12:52 +0300 Subject: [PATCH] Fix: drag not working if onDrop undefined --- customrenderedcomponents/customlist/customlist.js | 6 +++++- customrenderedcomponents/foundsetlist/foundsetlist.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/customrenderedcomponents/customlist/customlist.js b/customrenderedcomponents/customlist/customlist.js index e66a72b..f810de0 100644 --- a/customrenderedcomponents/customlist/customlist.js +++ b/customrenderedcomponents/customlist/customlist.js @@ -196,6 +196,11 @@ angular.module('customrenderedcomponentsCustomlist',['servoy']) pull: $scope.model.dragEnabled, // can drag into other lists put: $scope.model.dropEnabled, // can drop from other lists }; + + // copy data upon drag + if ($scope.model.dragEnabled) { + opts.setData = setData; + } // group name if ($scope.model.dragEnabled || $scope.model.dropEnabled) { @@ -228,7 +233,6 @@ angular.module('customrenderedcomponentsCustomlist',['servoy']) // opts.onChoose = onChoose; if ($scope.handlers.onDrop) { - opts.setData = setData; opts.onAdd = onAdd; opts.onRemove = onRemove; } diff --git a/customrenderedcomponents/foundsetlist/foundsetlist.js b/customrenderedcomponents/foundsetlist/foundsetlist.js index 74e5b06..cab8ed2 100644 --- a/customrenderedcomponents/foundsetlist/foundsetlist.js +++ b/customrenderedcomponents/foundsetlist/foundsetlist.js @@ -338,6 +338,11 @@ angular.module('customrenderedcomponentsFoundsetlist', ['servoy']) pull: $scope.model.dragEnabled, // can drag into other lists put: $scope.model.dropEnabled, // can drop from other lists }; + + // copy data upon drag + if ($scope.model.dragEnabled) { + opts.setData = setData; + } // group name if ($scope.model.dragEnabled || $scope.model.dropEnabled) { @@ -363,7 +368,6 @@ angular.module('customrenderedcomponentsFoundsetlist', ['servoy']) /** Events */ if ($scope.handlers.onDrop) { - opts.setData = setData; opts.onAdd = onAdd; }