From e6b3c5891e918557834daf70416c54240bb01441 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Sat, 29 Apr 2023 17:38:21 -0700 Subject: [PATCH] set an id through setupDragIn help debug #2231 * will need to figure out why clone element is not used directly on drop later. --- demo/two.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/demo/two.html b/demo/two.html index 1f6673df0..dee191a13 100644 --- a/demo/two.html +++ b/demo/two.html @@ -66,7 +66,7 @@

Two grids demo

let grids = GridStack.initAll(options); grids[1].float(false); - // new 4.x static method instead of setting up options on every grid (never been per grid really) but old options still works + // new 4.x static method instead of setting up options on every grid (never been per grid really) GridStack.setupDragIn('.sidebar .grid-stack-item', { appendTo: 'body', helper: myClone }); // GridStack.setupDragIn(); // second call will now work (cache last values) @@ -85,7 +85,9 @@

Two grids demo

// decide what the dropped item will be - for now just a clone but can be anything function myClone(event) { - return event.target.cloneNode(true); + const el = event.target.cloneNode(true); + el.setAttribute('gs-id', 'foo'); // TEST why clone element is not used directly on drop #2231 + return el; } function toggleFloat(button, i) {