This commit is contained in:
Kostiantyn Stoliarskyi 2023-06-01 16:03:36 +03:00
parent 65d04a2238
commit 5389e3a1e3
2 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
<div class="ml-6" data-dnd="dnd-sub-collection"> <div class="ml-6">
{% if not collection.is_leaf %} {% if not collection.is_leaf %}
<!-- if collection has sub_collection make for loop for it --> <!-- if collection has sub_collection make for loop for it -->
<!-- Nested accordion --> <!-- Nested accordion -->
@ -7,7 +7,8 @@
<div <div
id="accordion-nested-collapse" id="accordion-nested-collapse"
data-accordion="open" data-accordion="open"
data-sub-collection-id="{{sub_collection.id}}"> data-sub-collection-id="{{sub_collection.id}}"
data-dnd="dnd-sub-collection">
<!-- prettier-ignore --> <!-- prettier-ignore -->
<div class="flex items-center justify-start w-full font-medium text-left text-gray-500 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 dark:text-gray-400"> <div class="flex items-center justify-start w-full font-medium text-left text-gray-500 focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-800 dark:text-gray-400">
<button <button

View File

@ -16,8 +16,8 @@ export function initDnD() {
animation: 100, animation: 100,
onEnd: function (/**Event*/ evt) { onEnd: function (/**Event*/ evt) {
var itemEl = evt.item; // dragged HTMLElement var itemEl = evt.item; // dragged HTMLElement
console.log('evt.to', evt.to.getAttribute('data-collection-id')); console.log('we moved sub_collection', itemEl);
console.log('evt.to', evt.to.getAttribute('data-sub-collection-id'));
evt.to; // target list evt.to; // target list
console.log('evt.from', evt.from.getAttribute('data-collection-id')); console.log('evt.from', evt.from.getAttribute('data-collection-id'));
console.log( console.log(