Skip to content

Commit

Permalink
set an id through setupDragIn
Browse files Browse the repository at this point in the history
help debug gridstack#2231
* will need to figure out why clone element is not used directly on drop later.
  • Loading branch information
adumesny committed Apr 30, 2023
1 parent 26ea3d6 commit e6b3c58
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions demo/two.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h1>Two grids demo</h1>
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)

Expand All @@ -85,7 +85,9 @@ <h1>Two grids demo</h1>

// 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) {
Expand Down

0 comments on commit e6b3c58

Please sign in to comment.